0
Pls help me to explain line 1, 4, 5, 6
1. import java.io.*; 2. import java.util.Scanner; 3. public class Hello { 4. public static void main(String[ ] args) throws IOException { 5. InputStreamReader reader = new InputStreamReader(System.in); 6. BufferedReader input = new BufferedReader(reader); 7. System.out.print("Enter your name"); 8. String name = input.readLine(); 9. System.out.println ("Hello,"+ name + "!"); } }
1 ответ
+ 2
First line imports all the io(input output classes)
Line 4 is a main method..key for the program and it throws Input output exception if errors
Because io classes should be surround with try catch block or like this
Line 5 is a input class to get data from the user
Line 6 is a buffer reader reads the data from the input class