KnowledgeBoat Logo

Computer Science

Write down the syntax with reference to Java Programming:

to accept an integral value

Input in Java

3 Likes

Answer

//Input through InputStreamReader Class
InputStreamReader read = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(read);
int a = Integer.parseInt(in.readLine());
//Input through Scanner Class
Scanner in = new Scanner(System.in);
int a = in.nextInt();

Answered By

3 Likes


Related Questions