package zuoye;
public class Cat {
String name="妮妮";
String color="灰色";
int age=1;
void method()
{
System.out.println("姓名是:"+name);
}
void method2()
{
System.out.println("喵喵");
}
}
package zuoye;
import java.util.Scanner;
public class Main_cat {
public static void main(String[] args) {
Cat ca=new Cat();
Scanner sc=new Scanner(System.in);
System.out.println("输入妮妮的毛色:");
ca.color=sc.nextLine();
System.out.println("输入妮妮的年龄:");
ca.age=sc.nextInt();
ca.method();
ca.method2();
}
}