class Base{
public void f () {
System.out.println("f Throws Exception");
}
}
class Derived extends Base{
public void f() throws Exception{
System.out.println("f throws no Exception");
}
}
這個(gè)編譯會(huì)出錯(cuò)
class Base{
public void f () throws Exception {
System.out.println("f Throws Exception");
}
}
class Derived extends Base{
public void f() {
System.out.println("f throws no Exception");
}
}
這個(gè)沒有錯(cuò)