class Student
{ private int age ;
private static Student s = new Student();
private Student(){}
public static Student getStudent()
{
return s;
}
public void setAge(int age)
{
this.age=age;
}
public int getAge()
{
return age;
}
}
class StudentDemo
{ Student s1=Student.getStudent();
Student s2=Student.getStudent();
s1.setAge(20);
public static void mian()
{
System.out.println(s2.getAge);
}
}
{:soso_e103:}这段代码为什么编译时:
需要标示符s1.setAge(20);
非法的类型开始需要标示符s1.setAge(20);
搞不懂啊,大家能告诉我吗?
|