0

I can't understand the user input in java can any one help me please

6th Mar 2019, 7:24 AM
Sai Venkat
Sai Venkat - avatar
3 Answers
0
You can use the Scanner class to get user input Scanner scan = new Scanner(System.in); Wanna input a int? Use this int num = scan.nextInt(); Now print it out System.out.println("My number is "+num); Dont forget to import java.util package so you can use the Scanner class, add this line to the top: Import java.util.Scanner;
6th Mar 2019, 10:23 AM
JavaBobbo
JavaBobbo - avatar
0
Thanks a lot for clarification at first i confused that scanner is a object but now i understand that it is a class and we need to create a object to it
6th Mar 2019, 10:46 AM
Sai Venkat
Sai Venkat - avatar
0
You are welcome, glad i could help 😊
6th Mar 2019, 11:05 AM
JavaBobbo
JavaBobbo - avatar