class Cat { String name; int age; String color; //赋值的方法 public void set(String name, int age, String color) {//给参数赋值 this.name = name; this.age = age; this.color = color; } public String toString() {//输出的格式 如果