day06-面向对象-属性和行为的使用
This commit is contained in:
@@ -23,16 +23,16 @@ public class Student {
|
||||
|
||||
//吃饭
|
||||
public void eat(String food) {
|
||||
System.out.println("该学生在吃饭,吃"+food);
|
||||
System.out.println(name+"学生在吃饭,吃"+food);
|
||||
}
|
||||
|
||||
//睡觉
|
||||
public void sleep() {
|
||||
System.out.println("该学生在睡觉");
|
||||
System.out.println(name+"学生在睡觉");
|
||||
}
|
||||
|
||||
//学习
|
||||
public void study(String book) {
|
||||
System.out.println("该学生在学习,学"+book);
|
||||
System.out.println(name+"学生在学习,学"+book);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user