class TestException
{
static int x=1;
public static void main(String args[])
{
new TestException().fun();
}
void fun()
{
try
{
if(x==0)
throw new YException("yy");
else if(x==1)
throw new XException("xx");
}
catch(YException e)
{
System.out.println();
}
catch(XException e)
{
System.out.println();
}
}
}
{
static int x=1;
public static void main(String args[])
{
new TestException().fun();
}
void fun()
{
try
{
if(x==0)
throw new YException("yy");
else if(x==1)
throw new XException("xx");
}
catch(YException e)
{
System.out.println();
}
catch(XException e)
{
System.out.println();
}
}
}
跳到 catch(XException e) 去执行
{
System.out.println();
}
http://blog.csdn.net/justinavril/archive/2008/08/03/2761119.aspx
Maybe he defines them, which extends class Exception.