class Student{
private String name; private int age;
public Student(){}
public void setName(String name){ this.name=name; }
void setAge(int age){ this.age= age; }
}
public class StudentTest{
public static void main(String[] args){
Student s = new Student();
s.name = “Hellen”;
s.setAge(20);
}
}
//为什么不能这么赋值
|