class StudentTest
{
public static void main(String[] args)
{
Student stu = new Student();
stu.setName("林心如");
stu.setAge(30);
System.out.println(stu.getName()+"---"+stu.getAge());
}
}
class Student
{
private String name;
private int age;
public void setName(String n)
{
name = n;
}
public String getName()
{
return name;
}
public void setAge(int a)
{
age = a;
}
public int getAge()
{
return age;
}
}
|
|