Biblioteca Java - Blame information for rev 39
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
39 | mihai | 1 | package introducere.java.operator; |
4 | mihai | 2 | |
3 | /** | ||
4 | * The following program exemplify the use of unary operators. | ||
5 | * | ||
6 | */ | ||
7 | class UnaryDemo { | ||
8 | |||
9 | public static void main(String[] args){ | ||
10 | int result = +1; // result is now 1 | ||
11 | System.out.println(result); | ||
12 | result--; // result is now 0 | ||
13 | System.out.println(result); | ||
14 | result++; // result is now 1 | ||
15 | System.out.println(result); | ||
16 | result = -result; // result is now -1 | ||
17 | System.out.println(result); | ||
18 | boolean success = false; | ||
19 | System.out.println(success); // false | ||
20 | System.out.println(!success); // true | ||
21 | } | ||
22 | } |