Saturday, 25 May 2013

IllegalArgumentException

Bismillahir Rahmanir Raheem

Again there are lots of ways that you can get IllegalArgumentException , one of the way is when you call a method with wrong arguments.Like when you set the priority of a thread , you must give a priority level
between 1 to 10 otherwise it will result in IllegalArgumentException at runtime.

class IllegalArgument
{
  public static void main(String... args)
{
  Thread thread=new Thread();
  thread.setPriority(11);
  thread.start();
 }
}

It will result in IllegalArgumentException

No comments:

Post a Comment