手机类练习和一个对象内存图
作者:互联网
手机类练习
public class phone { String brand; double price; String color; public void call(String who){ System.out.println("给"+who+"打电话"); } public void sendMessage(){ System.out.println("群发短信"); } public static void main(String[] args) { phone phone = new phone(); System.out.println(phone.brand); System.out.println(phone.price); System.out.println(phone.color); System.out.println("==================="); phone.brand = "iQoo"; phone.color = "渐变蓝"; phone.price = 5000; System.out.println(phone.brand); System.out.println(phone.price); System.out.println(phone.color); phone.call("牛马"); phone.sendMessage(); } }
一个对象的内存图
标签:String,color,练习,System,phone,内存,println,手机,out 来源: https://www.cnblogs.com/yuzong/p/16425661.html