代码练习
package it.com.qq;
public class Phone2Demo {
public static void main(String[] args) {
Phone2 p=new Phone2();
p.brand="三星";
p.price=8450;
System.out.println(p.brand+p.price );//三星8450
Phone2 p2= p;
System.out.println(p2.brand+p2.price );//三星8450
p.brand="苹果";
p.price=8888;
System.out.println(p.brand+p.price );//苹果8888
System.out.println(p2.brand+p2.price );//苹果8888
}
}
网友评论