- 1
The output
I have this problem in this code Scanner input = new Scanner(System.in); String name; System.out.print("Enter your name? "); name=input.nextLine(); int number; System.out.print("Enter your number phone? "); number=input.nextInt(); String address; System.out.print("Enter your Address? "); address=input.nextLine(); The output ask the to enter just name and phone number anyone know why??
6 Respuestas
+ 2
Java is not Javascript.
Your code is Java and not Javascript: remove 'javascript' from your question tag ;)
[ edit ]
Reema thanks for your kindly edit :)
0
If you running here, give input like
(Name)
(integer) (Address)
Ex:
John
5 Hno: streat: state:
nextInt(); does not goes next line to read next input... So After reading int, after space everything goes to address.......
Or else if input is all contains single words, then use next() method instead of nextLine();
0
can you gave me example?
0
Reema
I already added an example. Just give as it is. And see output..
0
The trick is that scripts are compiled/executed on server side... output is captured and sended back to user side for displaying it: input are handle in similar manner (asked to user for all inputs at once -- one input per line), sended with the script to the server.
0
Yes now I understand where is the wrongin my code, thank you so much