+ 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
16 Réponses
+ 12
I just love coding and determined to be a better coder in the futher,now I am a student and learning programm
+ 7
You atleast tried 👍
https://code.sololearn.com/cK7tp46AJLjz/?ref=app
+ 6
Thank you so much🍀
+ 3
~ swim ~
Its not my program and it wasnt me who needed helt but yes the code works hehe
+ 3
You are welcome👍
+ 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.
+ 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
+ 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
+ 1
you need variables
+ 1
wow coding is soooo hard
+ 1
can somone pls tutor me?
- 1
Loving you💞🎈 You already completed java course and you asking this type of questions it's funny