public class A{
void process() throws Exception{
throw new Exception();
}
public static void main(String[] args) {
A a = new B();
a.process();
}
}
class B extends A{
void process(){
System.out.println("B ");
}
}
这道题的输出是什么?有谁能讲讲原理吗?
void process() throws Exception{
throw new Exception();
}
public static void main(String[] args) {
A a = new B();
a.process();
}
}
class B extends A{
void process(){
System.out.println("B ");
}
}
这道题的输出是什么?有谁能讲讲原理吗?
父类引用指向子类对象你可以去看博客专栏,专门的去了解,论坛上说不清楚的
http://zangweiren.blog.51cto.com/412366/94387
记住:类的示例就是对象