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

@@ -4,14 +4,8 @@ public class Demo02 {
public static void main(String[] args) {
//创建2个学生
Student s1 = new Student();
s1.name = "张三";
s1.age = 23;
s1.id = 3;
s1.study("java");
Student s2 = new Student();
s2.name = "李四";
s2.age = 2;
s2.id = 5;
s2.study("python");
}
}