public class InputTest {
public static void main(String[] args)
{
C c = new C();
try
{
c.getExcC();
}catch(Exception e)
{
System.out.println(e.getClass().getName());
}
}
}
class Aexception extends Exception
{
}
class Bexception extends Exception
{
}
class C
{
public void getExcA() throws Aexception
{
throw new Aexception();
}
public void getExcB() throws Bexception
{
throw new Bexception();
}
public void getExcC() throws Exception
{
try
{
getExcA();
}finally
{
getExcB();
}
}
}
结果:Bexception
public static void main(String[] args)
{
C c = new C();
try
{
c.getExcC();
}catch(Exception e)
{
System.out.println(e.getClass().getName());
}
}
}
class Aexception extends Exception
{
}
class Bexception extends Exception
{
}
class C
{
public void getExcA() throws Aexception
{
throw new Aexception();
}
public void getExcB() throws Bexception
{
throw new Bexception();
}
public void getExcC() throws Exception
{
try
{
getExcA();
}finally
{
getExcB();
}
}
}
结果:Bexception