public class Computer { //属性 //品牌 String PinPai; //型号 String XingHao; //内存大小 int NeiCun; //屏幕尺寸 double PingMu; //CPU型号 String Cpu; //重量 double Zl; //运行 void yunxing( int hs ) { System.out.println("运行程序花费" + hs +"秒"); } public static void main(String[] args) { Computer bijiben = new Computer(); bijiben.PinPai = "联想"; bijiben.XingHao = "Y700-ISE"; bijiben.NeiCun = 8; bijiben.PingMu = 15.6; bijiben.Cpu = "Intel 酷睿i7 6700HQ"; bijiben.Zl = 2.6; System.out.println("笔记本的品牌是" + bijiben.PinPai + ",型号为" + bijiben.XingHao + ",内存大小是" + bijiben.NeiCun + "GB" + ",屏幕尺寸是" + bijiben.PingMu + ",CPU型号是" + bijiben.Cpu + ",重量是" + bijiben.Zl + "Kg"); bijiben.yunxing(50); Computer taishi = new Computer(); taishi.PinPai = "华硕"; taishi.XingHao = "NX-6551"; taishi.NeiCun = 4; taishi.PingMu = 32; taishi.Cpu = "Intel 酷睿i9"; taishi.Zl = 6; System.out.println("台式机的品牌是" + taishi.PinPai + ",型号为" + taishi.XingHao + ",内存大小是" + taishi.NeiCun + "GB" + ",屏幕尺寸是" + taishi.PingMu + ",CPU型号是" + taishi.Cpu + ",重量是" + taishi.Zl + "Kg"); taishi.yunxing(30); //运行结果:运行程序花费50秒 //运行结果:笔记本的品牌是联想,型号为Y700-ISE,内存大小是8GB,屏幕尺寸是15.6,CPU型号是Intel 酷睿i7 6700HQ,重量是2.6Kg //运行结果:运行程序花费30秒 //运行结果:台式机的品牌是华硕,型号为NX-6551,内存大小是4GB,屏幕尺寸是32.0,CPU型号是Intel 酷睿i9,重量是6.0Kg } }