-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathArithmeticOperatorsDemo.java
More file actions
49 lines (36 loc) · 987 Bytes
/
ArithmeticOperatorsDemo.java
File metadata and controls
49 lines (36 loc) · 987 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
42
43
44
45
46
47
48
49
public class ArithmeticOperatorsDemo {
public static void main(String[] args) {
byte num1;
byte num2 = 5;
byte num3 = 3;
num1 = (byte) (num2 + num3);
num1 = 5 + 3;
double num4;
double num5 = 3.14;
byte num6 = 3;
num4 = num5 + num6;
System.out.println(num4);
int result1 = 9/2;
float result2 = 27/2.0f;
int result3 = 21%2;
byte num7 = 9;
byte num8 = 3;
num7 = (byte) +num8;
byte num9 = 9;
byte num10 = 3;
num7 = (byte) -num8;
byte num11 = -(-9);
int num12 = 42;
num12 += 3.3; // num12 = (int) (num12 + 3.3);
int num13 = 42;
num13 -= 3.3; // num13 = (int) (num13 - 3.3);
String str = "Hello";
str += 9;
int num14 = 45;
int num15 = 4;
num15 = num14++ + 5;
int num16 = 45;
int num17 = 4;
num17 = ++num16 + 5;
}
}