package 包名
public class Demo01PhoneOne {
public static void main(String[]args){
Phone one=new Phone();
System.out.println(one.brand);//null
System.out.println(one.price);//0.0
System.out.println(one.color);//null
System.out.println("=========");
one.brand="苹果";
one price =8388.0;
one.co1or="黑色";
System.out.print1n(one.brand);//苹果
System.out.println(one.price);//8388.0
System.out.print1n(one.co1or);//黑色
System.out.println("=========");
one.call("乔布斯");//给乔布斯打电话
one sendMessage();//群发短信
//将one当中保存的对象地址值赋值给two
Phone two=one;
System.out.println(two.brand);//苹果
System.out.println(two.price);//8388.0
System.out.println(two.color);//黑色
System.out.println("=========");
two.brand="三星";
two price =5999.0;
two.co1or="蓝色";
System.out.print1n(two.brand);//三星
System.out.println(two.price);//5999.0
System.out.print1n(two.co1or);//蓝色
System.out.println("=========");
one.call("欧巴");//给欧巴打电话
one sendMessage();//群发短信
}
}
内存图