-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTakingInput.java
54 lines (38 loc) · 1.74 KB
/
TakingInput.java
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
// import java.io.BufferedReader;
// import java.io.IOException;
// import java.io.InputStream;
// import java.io.InputStreamReader;
// import java.util.Scanner;
import java.io.*;
import javax.annotation.processing.FilerException;
public class TakingInput {
public static void main(String[] args) throws IOException {
// if you want to print on console what we do is we do system.out.println(),
// println is a method of printStream
// out is object of printStream, it is created inside system class, so we have
// to do system.out.println()
// System.out.println("Enter a Number : ");// how we take input
// System.in.read(); // read method returns int and it throws an exception, so
// we have to handle it
// int num = System.in.read(); // it will give me ascii value of anything i
// input
// only one character is read at a time
// System.out.println(num);
// System.out.println(num - 48);
// we have a special option of buffer reader
// java.io.BufferReader, first import
// we have to work with another class
// InputStreamReader in = new InputStreamReader(System.in);
// BufferedReader bf = new BufferedReader(in);
// // int num = bf.readLine(); // readline returns string
// int num = Integer.parseInt(bf.readLine());
// System.out.println(num);
// // we need to close the resource
// bf.close();
// in java-> nefw version we can use scanner
// Scanner sc = new Scanner(System.in);
// int num = sc.nextInt();
// System.out.println(num);
// sc.close();
}
}