0

Why when trying to input numbers from user, it shows error in this app??

I tried to input numbers using: import java.until.Scanner But it shows me errors in the code. Is it not possible to use the app in inputting numbers from use???

23rd Oct 2017, 3:33 AM
Senkwate
6 Respuestas
+ 7
If possible, please provide a Minimal, Complete, and Verifiable code @ Code Playground so we can help you to take a look on the code. 😉
23rd Oct 2017, 3:39 AM
Zephyr Koo
Zephyr Koo - avatar
+ 7
It'll show error if no input is given. After pressing the run button, an input window pops up. Enter any integer there and press submit. Working fine for me :) https://code.sololearn.com/c4IyBFsTxk3u/?ref=app
23rd Oct 2017, 8:49 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 6
It should be import java.util.Scanner;
23rd Oct 2017, 3:39 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 6
You missed to close the class body. Put a } at the end.
23rd Oct 2017, 4:48 AM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
Here is the code: 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); }
23rd Oct 2017, 4:39 AM
Senkwate
0
It still shows an error....
23rd Oct 2017, 8:23 AM
Senkwate