- class ExtendsTest4{
- public static void main(String[] args){
- Son s = new Son("zhangsan");
- //s.Son("张三");
- }
- }
- class Father{
- public Father(){
- System.out.println("fu wu can");
- }
-
- public Father(String name){
- System.out.println("fu dai can");
- }
- }
- class Son extends Father{
- public Son(){
- System.out.println("zi wu can");
- }
- public Son(String name){
- System.out.println("zi dai can");
- }
- }
复制代码
按道理来说两个赋值应该都是可以的呀,为什么注释的那个赋值为构造方法赋值就会编译出错呢?
|
|