嘿傢伙我可以得到一些幫助,這個Java項目我的問題是這條線學生s =新學生(r.getChar(),r.getChar(),r.getNum ),r.getNum());我想使它成爲一個數組,但如果我嘗試更換學生的白色學生s [i] =新學生(r.getChar()........)我得到一個錯誤告訴我,我不能從學生轉換以學生[]我NEAD的解決方案,使其成爲一個數組Java不能轉換從學生到學生[]
不介意r.getChar()
public class Student extends Person {
private int grade;
public Student(String name, String address, int age, int grade) {
super(name, address, age);
this.grade = grade;
}
public void setGrade(int grade){
this.grade = grade;
}
public int getGrade(){
return grade;
}
}
public class Person{
private String name;
private String address;
private int age ;
public Person(String name,String address,int age){
this.name = name;
this.address = address;
this.age = age;
}
public void setName(String name){
this.name = name;
}
public void setAddress(String address){
this.address = address;
}
public void setAge(int age){
this.age = age;
}
public String getName(){
return name;
}
public String getAddress(){
return address;
}
public int getAge(){
return age;
}
}
請嘗試將您的代碼修剪到需要表達的最小值。適當的格式也可能有所幫助。 –