You cannot define Default Construct function in Super class maybe.so , add notation as following,that's ok. /* public People(int age,String sex,double tall,float height,String name){ this.age=age; this.sex=sex; this.tall=tall; this.height=height; this.name=name; } */
为什么把这个给注释了?父类就没办法构造了
public People(){}
/*
public People(int age,String sex,double tall,float height,String name){
this.age=age;
this.sex=sex;
this.tall=tall;
this.height=height;
this.name=name; }
*/
1.父类添加 构造器 public People(){
}2.子类显式调用构造器
People(int age,String sex,double tall,float height,String name)具体原因见 will52000() 的解释!
谢谢!!!!!!
package com.itfuture.netoa.kaoqin;public class People {
public int age;
protected String sex;
double tall;
float height;
//private String name;
String name;
public People(int age,String sex,double tall,float height,String name){
this.age=age;
this.sex=sex;
this.tall=tall;
this.height=height;
this.name=name; }}package com.itfuture.netoa.kaoqin;public class Student extends People{
String school;
String banji;
public Student(int age,String sex,double tall,float height,String name,String school,String banji)
{
super(age,sex,tall,height,name);
this.school=school;
this.banji=banji; }
}