+ 1

Is it possible to ask a user to input numbers using this app???

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a number:"); int x = keyboard.nextInt(); System.out.println("You entered:"+x); } } The code above shows an error when trying to run it using this application. I am 100% sure there is no mistake in this code and if you run it on PC, it will work. Does that mean it is not posiible to take input from a user?

23rd Oct 2017, 8:25 AM
Senkwate
2 Antworten
+ 13
And I'm 200% sure that it'll work smooth, the only thing is the input prompt won't be having a query - "Enter a number:"
23rd Oct 2017, 9:43 AM
Dev
Dev - avatar
+ 5
Yes it will, if you consider string-->number
23rd Oct 2017, 9:46 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar