class Student
{
private String name;
private int age;
public Student(){}
public Student(String name,int age)
{
this.name = name;
this.age = age;
}
public void show()
{
System.out.println("大家好,我叫"+name+",今年"+age+"岁了.");
}
public void study()
{
System.out.println("好好学习,天天向上.");
}
}
class Test1
{
public static void main(String[] args)
{
Student s = new Student("奥巴马",40);
s.show();
s.study();
}
} |
|