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???
6 Antworten
+ 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. 😉
+ 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
+ 6
It should be
import java.util.Scanner;
+ 6
You missed to close the class body. Put a } at the end.
+ 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);
}
0
It still shows an error....