-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathUnary.java
34 lines (30 loc) · 947 Bytes
/
Unary.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Unary {
public static void main(String[] args) {
System.out.println("begin");
int i = 0;
System.out.println(i++);
System.out.println(++i);
System.out.println(-i);
System.out.println(--i);
System.out.println(i--);
System.out.println(+i);
float f = 0;
System.out.println(f++ == 0.0);
System.out.println(f == 1.0);
System.out.println(++f == 2.0);
System.out.println(-f == -2.0);
System.out.println(--f == 1.0);
System.out.println(f-- == 1.0);
System.out.println(+(-(++f)) == -1.0);
Integer w = 5;
System.out.println(w++);
System.out.println(w);
System.out.println(++w);
System.out.println(-w);
System.out.println(--w);
System.out.println(w--);
System.out.println(+w);
System.out.println(!true);
System.out.println(~24);
}
}