-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo17.java
More file actions
114 lines (93 loc) · 3.28 KB
/
Demo17.java
File metadata and controls
114 lines (93 loc) · 3.28 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
102
103
104
105
106
107
108
109
110
111
112
113
114
// import java.io.BufferedReader;
// import java.io.IOException;
// import java.io.InputStreamReader;
// import java.util.Scanner;
// class Input {
// public void read() throws IOException {
// System.out.print("Enter any key: ");
// int i = System.in.read();
// System.out.println("ASCII value: " + i);
// System.out.println("You entered the number: " + (i - 48));
// }
// public void input() throws IOException {
// System.out.print("Enter any key: ");
// InputStreamReader in = new InputStreamReader(System.in);
// BufferedReader br = new BufferedReader(in);
// int n = Integer.parseInt(br.readLine());
// System.out.println(n);
// br.close();
// }
// }
// =============================================
// =============================================
// class Resource {
// public void tryWithResources() throws IOException {
// BufferedReader br = null;
// try {
// System.out.print("Enter any number: ");
// InputStreamReader in = new InputStreamReader(System.in);
// br = new BufferedReader(in);
// int num = Integer.parseInt(br.readLine());
// System.out.println(num);
// } finally {
// br.close();
// }
// try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
// System.out.print("Enter any number: ");
// int num = Integer.parseInt(br.readLine());
// System.out.println(num);
// }
// }
// }
// =============================================
// =============================================
// class threadOne extends Thread{
// public void run(){
// for (int i = 1; i <= 10; i++) {
// System.out.println(i);
// }
// }
// }
// class threadTwo extends Thread{
// public void run(){
// for (int i = 1; i <= 100; i++) {
// System.out.println(i);
// }
// }
// }
public class Demo17 {
public static void main(String[] args) {
// 66. User Input Using BufferedReader & Scanner In Java
// Input input = new Input();
// try {
// input.read();
// } catch (IOException e) {
// System.out.println("An error occurred: " + e.getMessage());
// }
// try {
// input.input();
// } catch (IOException e) {
// System.out.println("An error occurred: " + e.getMessage());
// }
// System.out.print("Enter any number: ");
// Scanner sc = new Scanner(System.in);
// int num = sc.nextInt();
// System.out.println(num);
// =============================================
// =============================================
// 67. Try With Resources In Java
// Resource resource = new Resource();
// try {
// resource.tryWithResources();
// } catch (IOException e) {
// System.out.println("An error occurred: " + e.getMessage());
// }
// =============================================
// =============================================
// 68. Threads In Java
// threadOne t1 = new threadOne();
// threadTwo t2 = new threadTwo();
// t1.start();
// t2.start();
}
}