This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes IllegalArgumentException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "IllegalArgumentException" Watch "IllegalArgumentException" New topic
Author

IllegalArgumentException

Pawanpreet Singh
Ranch Hand

Joined: Jun 12, 2005
Posts: 264

Could any body please let me know an example for IllegalArgumentException.

I know this is checked exception and is subclass of RuntimeException.
Is it right?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Suppose you have a method which takes an int x as an argument. Further, suppose the value of x should be between 1 and 10. Then you could write:


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If you want to know what type of exception it is, look in the API.



It is unchecked, not checked as you wrote.
[ July 15, 2006: Message edited by: Barry Gaunt ]
Pawanpreet Singh
Ranch Hand

Joined: Jun 12, 2005
Posts: 264

Thanks for clearing my doubts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IllegalArgumentException
 
Similar Threads
iIlegal Argument Exception
Is this controlling flow with exceptions?
Exception Doubt
Wrapper Exception is good or not ??
method overriding