This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes error handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error handling" Watch "error handling" New topic

error handling

Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
i cannot understand this error

java.lang.NumberFormatException: For input string: " "

at java.lang.NumberFormatException.forInputString(

at java.lang.Integer.parseInt(

at mypackage.Calculator$16.actionPerformed(

at javax.swing.AbstractButton.fireActionPerformed(

at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(

at javax.swing.DefaultButtonModel.fireActionPerformed(

at javax.swing.DefaultButtonModel.setPressed(

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(

at java.awt.Component.processMouseEvent(

at java.awt.Component.processEvent(

at java.awt.Container.processEvent(

at java.awt.Component.dispatchEventImpl(

at java.awt.Container.dispatchEventImpl(

at java.awt.Component.dispatchEvent(

at java.awt.LightweightDispatcher.retargetMouseEvent(

at java.awt.LightweightDispatcher.processMouseEvent(

at java.awt.LightweightDispatcher.dispatchEvent(

at java.awt.Container.dispatchEventImpl(

at java.awt.Component.dispatchEvent(

at java.awt.EventQueue.dispatchEvent(

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(

at java.awt.EventDispatchThread.pumpEventsForHierarchy(

at java.awt.EventDispatchThread.pumpEvents(

at java.awt.EventDispatchThread.pumpEvents(


Vijayendra V Rao
Ranch Hand

Joined: Jul 04, 2004
Posts: 195
If the String that you are trying to parse has a space, then it throws this Exception. Try another approach.

Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"
Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
thnx for the reply..

how can i use the Integer.parseInt() method?..

where should i equate it?
Ramaswamy Narayanan

Joined: Jan 19, 2005
Posts: 24
to use the parseInt mehtod, you have to give the parameter which is a strnig but it has the integer value.

That is,
String str="100"
int i=Integer.parseInt(str);
It is sorta covered in the JavaRanch Style Guide.
subject: error handling
It's not a secret anymore!