+ 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?
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:"
+ 5
Yes it will, if you consider
string-->number