+ 14

have been confused by this easy problem,,,,

define a method that return the max of two numbers,always throw an error,but I have no idea about this error,......maybe you can help.me🌹 https://code.sololearn.com/cEuIiD7x60oJ/?ref=app

22nd Mar 2019, 12:01 AM
Jesscar🇨🇳🇭🇰
Jesscar🇨🇳🇭🇰 - avatar
12 ответов
+ 12
I just love coding and determined to be a better coder in the futher,now I am a student and learning programm
22nd Mar 2019, 2:11 AM
Jesscar🇨🇳🇭🇰
Jesscar🇨🇳🇭🇰 - avatar
22nd Mar 2019, 1:35 AM
JavaBobbo
JavaBobbo - avatar
+ 6
Thank you so much🍀
22nd Mar 2019, 2:12 AM
Jesscar🇨🇳🇭🇰
Jesscar🇨🇳🇭🇰 - avatar
+ 3
~ swim ~ Its not my program and it wasnt me who needed helt but yes the code works hehe
22nd Mar 2019, 2:03 AM
JavaBobbo
JavaBobbo - avatar
+ 3
You are welcome👍
22nd Mar 2019, 2:14 AM
JavaBobbo
JavaBobbo - avatar
+ 2
Your scanner read 4 numbers instead of 2. You should store the first two numbers and after printing them, put into the if and use always that values.
22nd Mar 2019, 11:15 PM
Yamil Luciano Castro D'Agostino
Yamil Luciano Castro D'Agostino - avatar
+ 2
"I just love coding and determined to be a better coder in the futher,now I am a student and learning programm" I respect the fact that you gave it a shot, tried to figure it out, didn't give up, and then came here to ask for "help". You didn't ask for the fix (although you got it) like I've seen a few time. Getting the fix with out understanding why the fix fixes the issue would be useless... Unless, of course, the problem was for your homework or something. I've always said that the best way to learn is to mess up. Often than not, I end up learning more on the topic than just what's needed to solve the problem because I end up playing with the solution a few different ways and end up learning something else about it. Anyways, Good luck
23rd Mar 2019, 4:44 AM
D. Booey 📜
D. Booey 📜 - avatar
+ 1
the problem is that you the second scanner is throwing an exception since everything the user enters has already been „consumed“ by the first scanner... your second scanner instance doesnt receive the user input and therefor the call to next.int() causes an exception since there is no int in scanner 2
22nd Mar 2019, 3:52 PM
Thomas Kraemer
Thomas Kraemer - avatar
+ 1
you need variables
22nd Mar 2019, 7:50 PM
FlameBlaze1
FlameBlaze1 - avatar
+ 1
wow coding is soooo hard
23rd Mar 2019, 4:36 PM
CodingPrincess
CodingPrincess - avatar
+ 1
can somone pls tutor me?
23rd Mar 2019, 4:36 PM
CodingPrincess
CodingPrincess - avatar
- 1
Loving you💞🎈 You already completed java course and you asking this type of questions it's funny
23rd Mar 2019, 9:11 PM
Saad Saleem
Saad Saleem - avatar