+ 2

Please how can I convert scanner into in java ?;

if I try int x = new Scanner (System.in) I keep on getting (Scanner cannot be converted to Int ) error

31st Dec 2017, 6:31 AM
Bakel
Bakel - avatar
2 Respostas
+ 3
Scanner x = new Scanner(System.in); After, use: x.nextInt(); or x.nextLine(); or x.nextDouble(); etc. to get the value the user entered.
31st Dec 2017, 6:34 AM
LunarCoffee
LunarCoffee - avatar
+ 3
thanks a lot for the answer I found a way and I used it in this code as an example https://code.sololearn.com/c9b9TFPD06qY/#
31st Dec 2017, 10:31 AM
Bakel
Bakel - avatar