创建一个名为Dog的类,包含两个String域。。。。。。自己写的一个不成熟的代码如下:
import java.lang.*;
class Dog{
String name;
String says;
}
public class pc {
public static void main(String[] args)
{
Dog dog1 = new Dog();
Dog dog2 = new Dog();
dog1.name = "cmm";
dog1.says = "ruff";
dog2.name = "wolf";
dog2.says = "skd";
System.out.println("dog1 is " + dog1.name + ",its says is "+ dog1.says + ".");
System.out.println("dog2 is " + dog2.name + ",its says is "+ dog2.says + ".");
}
}