class Student{
private String name;
private int age name;
public Student (String name int age){
this.name = name;
this.age = age;
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public int getAge(){
return age;
}
public void setAge(int age){
this.age = age;
}
public void show(){
System.out.println("名字:"+name+","+"年龄:"+age);
}
class Demo
{
public static void main(String[]args)
{
Student stu = new Student("小芳",16);
stu.setName("小狗");
stu.setAge(3);
System.out.println(stu.getName+"---"+stu.getAge);
}
}
//请大神看到后给出详细的注释可好.
|
|