+ 1
What is wrong with my code? I got 'cannot find the variable on this line' int x= myScanner.nextInt();
The error to this line of code is at the .nextInt I am trying to create a program that allows the user to input to integers and generate the sum of the numbers.
7 Respuestas
+ 1
Send the link of your code . So that it will be easier to figure it
+ 1
I have already shared yhe code publicly. I hope you can find it on my profile. I'd appreciate your help.
+ 1
Then why can't it run when I input the user inputs?
+ 1
Here's what happens, if I'm adding up numbers like 2 and 3, and I input them in the same line like 2 3 it will output 5 but if I input the numbers in different lines one on top and the other on the adjacent line, it will display an error.
+ 1
No problem it happened with me also when I was making my first calculator
0
No errors are present in your code
0
you have to place the 2 inputs in 2 lines, for example to get 5+7 you have to put the 5 in the first line, and 7 in the 2nd line of user input. Example: http://prntscr.com/wuroym