level 4
public class Student2{
private String name;
private int rp;
public Student(){}
public Student(String name;int rp){
this.name=name;
this.rp=rp;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public int getRp(){
return rp;
}
public void setRp(int rp){
if(rp>=1&&rp<=10)
this.rp=rp;
else
{
System.out.println("错误!rp必须为1~10");
this.rp=1;
}
}
public void introduction(){
System.out.println("hello呀!我是"+this.name+",我的人品值是"+this.rp);
}
}
2017年04月21日 11点04分