- 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??

10th Apr 2020, 1:55 PM
Reema
6 Answers
+ 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 :)
10th Apr 2020, 1:57 PM
visph
visph - avatar
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();
10th Apr 2020, 2:15 PM
Jayakrishna 🇼🇳
0
can you gave me example?
10th Apr 2020, 2:24 PM
Reema
0
Reema I already added an example. Just give as it is. And see output..
10th Apr 2020, 2:26 PM
Jayakrishna 🇼🇳
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.
10th Apr 2020, 2:29 PM
visph
visph - avatar
0
Yes now I understand where is the wrongin my code, thank you so much
10th Apr 2020, 2:37 PM
Reema