package net.dharmaraj;
public class ThrowsDemo
{
static void throwMethod() throws IllegalAccessException
{
System.out.println("Inside throwMetho.");
throw new IllegalAccessException("demo");
}
public static void main(String a[])
{
// ThrowsDemo s=new ThrowsDemo();
try
{
throwMethod();
}
catch (IllegalAccessException e)
{
System.out.println("Caught " + e);
}
}
}
Out Put:--
Inside throwMetho.
Caught java.lang.IllegalAccessException: demo
No comments:
Post a Comment