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(){ return "姓名:"+name+"\t年龄:"+age+"\t颜色:"+color; } public Cat abc(){ return this; } } public class A6_11{ public static void main(String[] args){ Cat one=new Cat(); Cat two=new Cat(); one.set("小明",12,"黑色"); two.set("小红",14,"紫色"); Cat three=new Cat(); three=two.abc(); System.out.println(one); System.out.println(two); System.out.println(three); } } 这里总是提示Cat类 The type Cat is already defined 我用记事本编的一样的程序在CMD下就可以运行。这是为啥呢
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(){ return "姓名:"+name+"\t年龄:"+age+"\t颜色:"+color; } public Cat abc(){ return this; } } public class A6_11{ public static void main(String[] args){ Cat one=new Cat(); Cat two=new Cat(); one.set("小明",12,"黑色"); two.set("小红",14,"紫色"); Cat three=new Cat(); three=two.abc(); System.out.println(one); System.out.println(two); System.out.println(three); } } 这里总是提示Cat类 The type Cat is already defined 我用记事本编的一样的程序在CMD下就可以运行。这是为啥呢