Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wrong output

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code was running fine for 5 minutes but now gives an wrong output
when i entered 50 50 50 it throws to catch clause which is NumberFormatException ,
which is not supposed to happen , whats wrong here can any one tell me

 
Campbell Ritchie
Sheriff
Posts: 48448
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said before, why are you not using a Scanner?
If you enter the line "50 50 50", that is not in the correct format for a number. It might be correct for three numbers, but your code requires you get one number out of it.
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:As I said before, why are you not using a Scanner?
If you enter the line "50 50 50", that is not in the correct format for a number. It might be correct for three numbers, but your code requires you get one number out of it.

thanks i got that
 
Campbell Ritchie
Sheriff
Posts: 48448
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic