public class InitailTelphone { public static void main(String[] args) {// Telphone phone = new Telphone(); Telphone.call(); Telphone.cpu = 5.2f; Telphone.mem = 5.6f; Telphone.screen = 1.2f; Telphone.call();}}public class Telphone { //定义类的属性 static float screen; static float cpu; static float mem; //定义类的方法 static void call(){ float cpu = 1.22f; System.out.println("screen:"+screen+" cpu:"+cpu+" mem:"+mem+" Telphone有打电话的功能"); } void sendMessage(){ System.out.println("Telphone有发短信的功能"); }}
3 回答
添加回答
举报
0/150
提交
取消