From d71fae3ba5d89d6fda1cacf34ee922ed9303e1b7 Mon Sep 17 00:00:00 2001 From: Wangyanshu <2680603193@qq.com> Date: Thu, 7 May 2026 15:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'=E6=8C=91=E6=88=98?= =?UTF-8?q?=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 挑战题 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 挑战题 diff --git a/挑战题 b/挑战题 new file mode 100644 index 0000000..601dfb5 --- /dev/null +++ b/挑战题 @@ -0,0 +1,21 @@ +public class Person { + private String name; + private int age; + + public Person() {} + public Person(String name, int age) { + this.name = name; + this.age = age; + } + + // 统一的基础信息打印方法 + public void showInfo() { + System.out.println("姓名:" + name + ",年龄:" + age); + } + + // getter/setter + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public int getAge() { return age; } + public void setAge(int age) { this.age = age; } +} \ No newline at end of file