Repository navigation
Expand file tree
/
Copy pathDay9.java
More file actions
101 lines (92 loc) · 2.33 KB
/
Copy pathDay9.java
File metadata and controls
101 lines (92 loc) · 2.33 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package JHomeworks;
public class Day9 {
public static void main(String[] args) {
// 1. Write program that gets two inputs from user then prints sum
// 2. Write simple calculator,
// a. reads first input
// b. reads operator (+, -, *, /)
// c. reads second input
// d. prints result
// 3. Write program that calculates from string:
// ex: one plus nine => 10, four subtract 2 => 2
//
// public class Test {
// public static void main(String[] args)
// {
// for (;;)
// System.out.println("TECHNO");
// }
// }
////Options:
////1.TECHNO
////2.Compile time error "ANSWER IS 2"
////3.Run time Exception
////4.TECHNO (Infinitely)
//
// class Test {
// public
// static void main(String[] args)
// {
// for (int i = 0; i < 3)
// System.out.println("TECHNO");
// }
// }
////Options:
////1.TECHNO TECHNO TECHNO
////2.Compile time error "ANSWER IS 2"
////3.TECHNO (Infinitely)
////4.No output
//
// class Test {
// public static void main(String[] args)
// {
// boolean b = true;
// if (b = false) {
// System.out.println("HELLO");
// } else {
// System.out.println("BYE");
// }
// }
// }
////Option:
////1.HELLO
////2.BYE "ANSWER IS 2"
////3.Compile time error: re- initialization
////4.No output
//
// public class Test {
// public
// static void main(String[] args)
// {
// int a = 10, b = 20;
// if (a < b) {
// if (a > b) {
// System.out.println("HELLO TECHNO");
// } else {
// System.out.println("WELCOME");
// }
// }
// }
// }
////Option:
////1.HELLO TECHNO
////2.WELCOME "ANSWER IS 2"
////3.Compile time error
////4.HELLO TECHNO WELCOME
//
// class Test {
// public static void main(String[] args)
// {
// for (int i = 0;; i++) {
// System.out.println("HIII");
// }
// System.out.println("BYE");
// }
// }
////Options:
////1. HIII
////2. HIII(infinitely)
////3. BYE
////4. Compile time error "ANSWER IS 4"
}
}