public class people
{
protected char name;
protected int age;
people()
{
System.out.println("the people consturconter is called");
}
people(char x,int y)
{
name=x;
age=y;
}
}
class teacher extends people
{
String zhicheng;
private float salary;
teacher()
{
System.out.println("teacher constructor is called");
}
teacher(char x,float y,char name,int age)
{
super(name,age);
zhicheng=x;
salary=y;
}
}
class student extends teacher
{
private char grade;
private float score;
student()
{
System.out.println("the student consturcoter is called");
}
public static void main(String[] args)
{
student s=new student();
teacher t=new teacher("teacher",1000,"liusujie",21);}}
people.java:26: incompatible types
found : char
required: java.lang.String
zhicheng=x;
^
people.java:41: cannot resolve symbol
symbol : constructor teacher (java.lang.String,int,java.lang.String,int)
location: class teacher
teacher t=new teacher("teacher",1000,"liusujie",21);
^
2 errors出现以上错误,是哪错了?
{
protected char name;
protected int age;
people()
{
System.out.println("the people consturconter is called");
}
people(char x,int y)
{
name=x;
age=y;
}
}
class teacher extends people
{
String zhicheng;
private float salary;
teacher()
{
System.out.println("teacher constructor is called");
}
teacher(char x,float y,char name,int age)
{
super(name,age);
zhicheng=x;
salary=y;
}
}
class student extends teacher
{
private char grade;
private float score;
student()
{
System.out.println("the student consturcoter is called");
}
public static void main(String[] args)
{
student s=new student();
teacher t=new teacher("teacher",1000,"liusujie",21);}}
people.java:26: incompatible types
found : char
required: java.lang.String
zhicheng=x;
^
people.java:41: cannot resolve symbol
symbol : constructor teacher (java.lang.String,int,java.lang.String,int)
location: class teacher
teacher t=new teacher("teacher",1000,"liusujie",21);
^
2 errors出现以上错误,是哪错了?
public class people {
protected String name; protected int age; people() {
System.out.println("the people consturconter is called");
} people(String x, int y) {
name = x;
age = y;
}
}class teacher extends people {
String zhicheng; private float salary; teacher() {
System.out.println("teacher constructor is called");
} teacher(String x, float y, String name, int age) {
super(name, age);
zhicheng = x;
salary = y;
}
}class student extends teacher {
private char grade; private float score; student() {
System.out.println("the student consturcoter is called");
} public static void main(String[] args) {
student s = new student();
teacher t = new teacher("teacher", 1000, "liusujie", 21); }}