Spaces:
Running
Running
Create 13B. Expression Statements Values+++
Browse files
Week 7: Enum, Generic Type, Streams, write to file, class diagram/13B. Expression Statements Values+++
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
row1
|
| 2 |
+
int a = 3;
|
| 3 |
+
int b = a++ + 1;
|
| 4 |
+
|
| 5 |
+
a = 4; // a++
|
| 6 |
+
b = 4; // initial 'a' 3 + 1
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
row2
|
| 10 |
+
int a = 3;
|
| 11 |
+
int b = ++a + 1;
|
| 12 |
+
|
| 13 |
+
a = 4; // ++a
|
| 14 |
+
b = 5; // updated 'a' 4 + 1
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
row3
|
| 19 |
+
int a = 1;
|
| 20 |
+
int b = ++a + ++a;
|
| 21 |
+
|
| 22 |
+
a = 3; // ++a then ++a again
|
| 23 |
+
b = 5; // LHS ++a 2 + RHS ++a 3
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
row 4
|
| 28 |
+
int a = 3;
|
| 29 |
+
int b = a++ + a--;
|
| 30 |
+
|
| 31 |
+
a = 3; // a++ then a--
|
| 32 |
+
b = 7; // initial 'a' 3 + LHS 'a' 4
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
row5
|
| 37 |
+
int a = 3;
|
| 38 |
+
int b = --a; // --a => so 'a' decrease from 3 to 2, AND b = updated 'a' = 2
|
| 39 |
+
a = --b; // --b => so 'b' decrease from 2 to 1, AND a = updated 'b' = 1
|
| 40 |
+
|
| 41 |
+
a = 1;
|
| 42 |
+
b = 1;
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|