This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes ghost number format exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ghost number format exception" Watch "ghost number format exception" New topic
Author

ghost number format exception

amrish sharma
Greenhorn

Joined: Sep 24, 2009
Posts: 20
i am taking value from jlabel for ex its 1000
i want to make substraction operation on it
when i convert into string to int
it gives this error


my code for convertion is this


please reply as soon as possible
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10175
    
    8

Remove the " from "1000 to fix your problem


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
amrish sharma
Greenhorn

Joined: Sep 24, 2009
Posts: 20
i found the solution

thanks all
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

The correct way to do this is to use a try block and catch the exception if it occurs. You can't trust user input to be in the correct format!


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ghost number format exception
 
Similar Threads
Initialisers
Thread Ques
SIMPLE updating dialog!!!
Java Guessing Game - OutOfMemoryError
how to print from 1 to 9 in a label ?