day06-面向对象之封装的步骤与使用

This commit is contained in:
2026-01-19 11:04:06 +08:00
parent 138e09fba1
commit f1c23824f8
4 changed files with 59 additions and 13 deletions

View File

@@ -30,7 +30,7 @@ public class Demo01 {
*/
//学生对象的属性和行为的操作
//学生对象的属性值的设置
s.name = "张三";
/*s.name = "张三";
s.age = 22;
s.id = 10;
s.gender = "男生";
@@ -38,7 +38,7 @@ public class Demo01 {
//学生对象的属性值的获取
System.out.println(s.name);
System.out.println(s.score);
System.out.println(s.gender);
System.out.println(s.gender);*/
//调用学生对象的行为(成员方法)
s.eat("肯德基");