This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes wrong  output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "wrong  output " Watch "wrong  output " New topic
Author

wrong output

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 688

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



The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37950
    
  22
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

Joined: Jul 03, 2011
Posts: 688

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

Joined: Oct 13, 2005
Posts: 37950
    
  22
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wrong output
 
Similar Threads
why netbeans is showing output in this way ?
how to achieve this ?
2 methods into one?
whats wrong with my code ?
problem with try catch