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 + "!"); } }

31st Aug 2021, 9:10 AM
Muhammad Abdulmalik
Muhammad Abdulmalik - avatar
1 Antwort
+ 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
31st Aug 2021, 9:15 AM
Vtec Fan
Vtec Fan - avatar