Exception in thread “main” java.lang.IllegalArgumentException

Posted: May 9, 2012 in Java

IllegalArgumentException:

It is the child class of Runtime Exception and it is unchecked. Thrown by programmer or API developer to indicate that a method has invoked with an illegal or in appropriate argument.

It is not JVM Exception.

Example:

public class Test {

 public static void main(String[] args) {

Thread.currentThread().setPriority(100);   ———-> here possible values are 1 to 10. (except 1 to 10 throws illegalArguementException)

}}

Output:

Exception in thread “main” java.lang.IllegalArgumentException

at java.lang.Thread.setPriority(Thread.java:1015)

at com.clarity.test1.main(test1.java:95)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s