| package cn.itcast.day01; 
 public class ConstrutorDemo {
 public static void main(String[]args){
 B b=new B("执行");
 }
 }
 class A{
 String name="哈哈";
 int hand=2;
 
 public A(){
 System.out.println("A不带参数构造方法");
 }
 public A(String str){
 System.out.println(str+"name:" + name + "---hand:" + hand);
 }
 }
 class B extends A{
 public B(String y){
 super(y);
 }
 }
 
 
 二楼哥们的这代码块
 public B (String Y)
 
 17.                {
 
 18.                                super("w");
 
 19.                /*此处不写super();也会默认调用父类A无参构造函数,
 
 20.                我只想继承父类成员变量与成员方法,如何不让他执行父类无参构造函数*/
 
 21.                //System.out.println("name:"+name+"  hand:"+hand);
 
 22.                }
 
 super(参数) 这参数应该是变量Y吧,
 这过程中,唐的代码,参数没有参与到代码中
 
 |