Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

IllegalArgumentException  RSS feed

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 264
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clearing my doubts.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!