public class Test {
public static void main(String[] args) {
Person p1 = new Person();
p1.name = "麦克";
p1.country = "美国";
Person p2 = new Person();
p2.name = "红杉";
p2.country = "韩国";
p1.speak();
p2.speak();
}
}
class Person {
String name;
static String country = "中国";
public void speak() {
System.out.println(name + "..." + country);
}
}
为什么输出后两个人的国籍都是韩国啊?求解答啊
|
|