From 9d69f6eb26c57e9c7e120a962ccbfd58b8e04fac Mon Sep 17 00:00:00 2001 From: spclock <58385369+spclock@users.noreply.github.com> Date: Sat, 4 Jan 2020 12:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=87=8D=E8=BD=BD=E7=9A=84?= =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/github/hcsp/objectbasic/Cat.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/github/hcsp/objectbasic/Cat.java b/src/main/java/com/github/hcsp/objectbasic/Cat.java index c9d7663..b5942dd 100644 --- a/src/main/java/com/github/hcsp/objectbasic/Cat.java +++ b/src/main/java/com/github/hcsp/objectbasic/Cat.java @@ -11,11 +11,14 @@ public class Cat { /** 创建一只指定名字的猫,age的默认值是1,cute的默认值是true */ public Cat(String name) { // 请在这里使用this()调用其他的构造器 + this.name=name } /** 创建一只指定名字和年龄的猫,cute的默认值是true */ public Cat(String name, int age) { // 请在这里使用this()调用其他的构造器 + this.name=name; + this.age=age; } /** 创建一只指定名字、年龄和萌属性的猫 */