+ 4

What is the statement to accept an input from user in java

for eg. to accept a value for int x;

26th Feb 2017, 2:00 PM
sanskriti
sanskriti - avatar
2 Respuestas
+ 5
See readInput() method in https://code.sololearn.com/cAfnLE0W37f4/?ref=app Instead of nextLine use nextInt and assign the return value to an int.
26th Feb 2017, 3:36 PM
Tashi N
Tashi N - avatar
0
try import java.util.scanner; scanner name=new scanner(system.in);
28th Feb 2017, 2:19 AM
Deadvilla SNdip Neupane
Deadvilla SNdip Neupane - avatar