代码
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();//群发短信
Phone two=new Phone();
System.out.println(two.brand);//null
System.out.println(two.price);//0.0
System.out.println(two.color);//null
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();//群发短信
}
}
内存图