修改项目目录

This commit is contained in:
2024-10-09 11:06:06 +08:00
parent 028ae17647
commit a3e84dc516
29 changed files with 457 additions and 17 deletions

View File

@@ -0,0 +1,37 @@
package chapter3;
class Student {
String name;
int age;
String sex;
void read() {
System.out.println("大家好,我是" + name + ",我在看书!");
}
void introduce() {
System.out.println("大家好,我叫" + name + ",我今年" + age + "岁了,我是" + sex + "");
}
}
public class Example01 {
public static void main(String[] args) {
Student s1 = new Student();
Student s2 = new Student();
s1.name = "小明";
s1.sex = "";
s1.age = 20;
s2.name = "小红";
s2.sex = "";
s2.age = 19;
s1.read();
s2.read();
s1.introduce();
s2.introduce();
}
}