-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignmentTwo
More file actions
58 lines (53 loc) · 2.26 KB
/
AssignmentTwo
File metadata and controls
58 lines (53 loc) · 2.26 KB
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
50
51
52
53
54
55
56
57
58
/**
* My Assignment Two
* @author Kumin In
*
*/
public class AssignmentTwo
{
/**
* @param args
*/
public static void main(String[] args)
{
byte theByte = 124;
short theShort = 1;
int theInt = 2;
long theLong = 15;
float theFloat = (float) 4.5;
double theDouble = 5.9;
char theChar = 'a';
boolean theBoolean = true;
System.out.println("theByte = " + theByte);
System.out.println("theShort = " + theShort);
System.out.println("theInt = " + theInt);
System.out.println("theLong = " + theLong);
System.out.println("theFloat = " + theFloat);
System.out.println("theDouble = " + theDouble);
System.out.println("theChar = " + theChar);
System.out.println("theBoolean = " + theBoolean);
System.out.println("theByte + theShort = " + (theByte + theShort));
System.out.println("theByte - theShort = " + (theByte - theShort));
System.out.println("theByte * theLong = " + (theByte * theLong));
System.out.println("theByte << 4 = " + (theByte<<4) );
System.out.println("Execute: theByte = theByte << 4");
theByte = (byte)(theByte << 4);
System.out.println("theByte = " + theByte);
System.out.println("theLong * 128 = " + (theLong * 128));
System.out.println("theLong / 128 = " + (theLong/128));
System.out.println("theLong / 128.0 = " + (theLong/128.0));
System.out.println("0 < theLong < 2 is " + (0 < theLong && theLong < 2));
System.out.println("0 < theLong < 100 is " + (0 < theLong && theLong <100));
System.out.println("theLong equals theLong is " + (theLong == theLong));
System.out.println("theLong not equals theLong is " +(theLong != theLong));
System.out.println("theChar + theChar = " + (char)(theChar + theChar));
System.out.println("theChar + 1 = " + (char)(theChar + 1));
System.out.println("theLong modulus 3 = " + (theLong % 3));
System.out.println("theLong modulus 2 = " + (theLong % 2));
System.out.println("theLong modulus 1 = " + (theLong % 1));
System.out.println("theBoolean and theBoolean is " + (theBoolean && theBoolean));
System.out.println("not(theBoolean and theBoolean) is " + !(theBoolean && theBoolean));
System.out.println("(not theBoolean) and theBoolean is " + ((!theBoolean) && theBoolean));
System.out.println("theBoolean or (not theBoolean) is " + (!theBoolean || theBoolean));
}
}