-
-
Save creyn/925d8a391694536a52d102aae5b6b661 to your computer and use it in GitHub Desktop.
Droga Programisty : Kod : Matematyka w Javie 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OperatoryUnarne { | |
public static void main(String args[]) { | |
System.out.println("Operatory unarne\n"); | |
int liczbaA = 5; | |
// chcemy dodac 10 do naszej zmiennej | |
// standardowy opeartor | |
liczbaA = liczbaA + 10; | |
System.out.println("Liczba A : " + liczbaA); | |
// opearator przypisania dodatniego | |
liczbaA += 10; | |
System.out.println("Liczba A : " + liczbaA); | |
// teraz odejmujemy 2 od naszej zmiennej | |
// standardowy operator | |
liczbaA = liczbaA - 2; | |
System.out.println("Liczba A : " + liczbaA); | |
// opearator przypisania ujemnego | |
liczbaA -= 2; | |
System.out.println("Liczba A : " + liczbaA); | |
// teraz chcemy dodawac 1 do naszej zmiennej | |
// standardowy operator | |
liczbaA = liczbaA + 1; | |
System.out.println("Liczba A : " + liczbaA); | |
// operator przypisania dodatniego | |
liczbaA += 1; | |
System.out.println("Liczba A : " + liczbaA); | |
// operator inkrementacji | |
liczbaA++; | |
System.out.println("Liczba A : " + liczbaA); | |
// i na koniec operator dekrementacji | |
liczbaA--; | |
System.out.println("Liczba A : " + liczbaA); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment