This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Exception Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception Question" Watch "Exception Question" New topic

Exception Question

George Han

Joined: Aug 17, 2005
Posts: 17
Is there an Excetion that means that it is not String? kinda like NumberFormatException?
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Well, NumberFormatException means the string's not a number. Anything can have a string representation so it's not clear what you mean. You can have an empty string or a null string or a non-string in terms of a class other than string. Certainly there is NullPointerException (I guess Java does have pointers) and ClassCastException and IllegalArgumentException (of which NumberFormatException is a family member) but that's about it.
Kudret Serin
Ranch Hand

Joined: Aug 02, 2005
Posts: 167

why do you need this Exception?
George Han

Joined: Aug 17, 2005
Posts: 17
Here is my code

Im tryign to loop it but I need to fix a problem When I press 3 after the first time and 3 again it doenst loop correctly.
Ramesh Shanmugam
Ranch Hand

Joined: Sep 13, 2004
Posts: 132
Number Format Exception will Mostly occur when you try to convert a string to a integer and if cant convert it to int the Exception will occur.

Ramesh Shanmugam - SCJP 1.5
I agree. Here's the link:
subject: Exception Question
It's not a secret anymore!