KnowledgeBoat Logo

Computer Science

Write down the syntax with reference to Java Programming:

to accept a line of text

Input in Java

1 Like

Answer

//Input through InputStreamReader Class
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
String str = in.readLine();
//Input through Scanner Class
Scanner in = new Scanner(System.in);
String str = in.nextLine();

Answered By

3 Likes


Related Questions