-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
41 lines (37 loc) · 760 Bytes
/
Copy pathMain.java
File metadata and controls
41 lines (37 loc) · 760 Bytes
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
35
36
37
38
39
40
41
/**
Diana Copeland
Exercise 3-1: Using Compound Assignment Operators
*/
public class Main {
public static void main(String[] args) {
byte a;
//prints 13
a = 10;
System.out.println(a += 3);
//prints 12
a = 15;
System.out.println(a -= 3);
//prints 60
a = 20;
System.out.println(a *= 3);
//prints 8
a = 25;
System.out.println(a /= 3);
//prints 0
a = 30;
System.out.println(a %= 3);
/* Anything below this point is not covered on the OCA */
a = 35;
System.out.println(a &= 3);
a = 40;
System.out.println(a ^= 3);
a = 45;
System.out.println(a |= 3);
a = 50;
System.out.println(a <<= 3);
a = 55;
System.out.println(a >>= 3);
a = 60;
System.out.println(a >>>= 3);
}
}