ThrowTest.java
public class ThrowTest
{
public static void main(String[] args)
{
int a = 100;
if(a == 100)
{
try
{
throw new ExceptionTest2();
}
catch(ExceptionTest2 e)
{
e.printStackTrace();
}
}
}
}
ExceptionTest2.java
public class ExceptionTest2 extends Exception
{
public ExceptionTest2()
{
super("my exception");
}
}
댓글 없음:
댓글 쓰기