静态变量看你调用时上一次的赋值,,,,,,,p1,p2调用时上一次都是韩国,所以国籍都是韩国.....
Person p1 = new Person();
p1.name = “麦克”;
p1.country = "美国";
p1.speak();----------------------------->>>>>>这样就是美国
Person p2 = new Person();
p2.name = "红杉";
p2.country = "韩国";
p2.speak();--------------------------->>>>>>>韩国
这种
Person p1 = new Person();
p1.name = “麦克”;
p1.speak();---------------------------->>>>>中国
p1.country = "美国";
Person p2 = new Person();
p2.name = "红杉";
p2.country = "韩国";
p2.speak();------------------------->>>>.韩国 |