Interface Inter
{
public void show();
}
class Demo implement Inter
{
public void show()
{
try{
throw new Exception();
}catch(Exception e)
{
code...;
throw new RuntimeException("");// 告知调用者问题所在。
}
}
}
Exception
|--AException
|--AAException
|--BException
*/
class AException extends Exception
{
}
class BException extends Exception
{
}
class AAException extends AException
{
}
class Fu
{
void show()
{
}
}
/*
class Tool
{
void method(Fu f)//Fu f = new Zi();
{
try
{
f.show();
}
catch (AException ex)//AException ex = new AAException();
{
}
}
}
Tool t = new Tool();
//t.method(new Fu());
t.method(new Zi());
*/
class Zi extends Fu
{
void show()throws RuntimeException
{
}
}
class ExceptionDemo11
{
public static void main(String[] args)
{
Zi z = new Zi();
try{
z.show();
}catch(RuntimeException e)
{}
}
}