10th Dec 2018, 2:58 PM
Jax Young
Jax Young - avatar
4 Respostas
+ 3
Also, you cant use 2 Scanner objects like you did. Just use one for input as many time you need. x = num1.nextInt(); y = num1.nextInt(); ....... And Scanner num2 delete. With this and what is said in Raj Chhatrala answer, your code will work.
10th Dec 2018, 6:38 PM
vlada
+ 6
In java, everything must be wrapped in a function(method) Last to print statements in your code are outside of your method. Try wrapping then into a new method or in existing one.
10th Dec 2018, 3:20 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 3
Oh yes, I missed to notice that two objects of scanner. Nice catch vlada
10th Dec 2018, 6:40 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 1
Raj Chhatrala vlada Thanks a lot! It's so nice of you.Without your help, I can't imagine how much time I will spend to fix the bug.
11th Dec 2018, 3:08 PM
Jax Young
Jax Young - avatar