import com.sun.org.apache.xpath.internal.functions.Function;
class AException extends Exception
{
}
class BException extends AException
{
}
class CException extends Exception
{
}
class Fu
{
public void show() throws AException
{
}
}
class Test
{
void function(Fu f)
{
try {
f.show();
} catch (AException e) {
e.printStackTrace();
}
}
}
class Zi extends Fu
{
public void show() throws CException
{
}
}
class ExceptionDemo5 {
public static void main(String[] args) {
Test test = new Test();
test.function(new Fu());
test.function(new Zi());
}
}
以上代码能通过编译吗?为什么
|
|