黑马程序员技术交流社区

标题: 关于继承extends的问题 [打印本页]

作者: 爱上你的微笑    时间: 2016-5-21 23:31
标题: 关于继承extends的问题
class Undergraduate extends Student {
                String specialty;
                public Undergraduate(){}
                public Undergraduate(String name,int age,String degree,String specialty){
                        this.name = name;
                        this.age = age;
                        this.degree = degree;
                        specialty = specialty;
为什么写成this.name = name;不行呢
作者: 心飞扬哈哈    时间: 2016-5-21 23:49
你都没声明成员变量啊




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2