diff --git a/day06/src/com/inmind/constructor03/Cat.java b/day06/src/com/inmind/constructor03/Cat.java new file mode 100644 index 0000000..ceec439 --- /dev/null +++ b/day06/src/com/inmind/constructor03/Cat.java @@ -0,0 +1,53 @@ +package com.inmind.constructor03; + +public class Cat { + //属性 + private String name; + private int age; + private String color; + + //构造方法 + //alt+insert + public Cat() { + } + + public Cat(String name, int age, String color) { + this.name = name; + this.age = age; + this.color = color; + } + + public Cat(String name) { + this.name = name; + } + + //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; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + //行为 + public void catchMouse() { + System.out.println("抓老鼠"); + } +}