Skip to content

Commit 8f5c859

Browse files
Expressions & Increment/Decrement Operators
1 parent 15a221c commit 8f5c859

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.company;
2+
3+
public class cwh_10_resulting_data_type {
4+
public static void main(String[] args) {
5+
/* byte x = 5;
6+
int y = 6;
7+
short z = 8;
8+
int a = y + z;
9+
float b = 6.54f + x;
10+
System.out.println(b); */
11+
12+
// Increment and Decrement Operators
13+
int i = 56;
14+
// int b = i++; // first b is assigned i (56) then i is incremented
15+
int j = 67;
16+
int c = ++j; // first j is incremented then c is assigned j (68)
17+
System.out.println(i++);
18+
System.out.println(i);
19+
System.out.println(++i);
20+
System.out.println(i);
21+
int y = 7;
22+
System.out.println( ++y *8);
23+
char ch = 'a';
24+
System.out.println(++ch);
25+
}
26+
}

0 commit comments

Comments
 (0)