aspose file tools*
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
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