森女妮萌
2018-01-09 17:19
package com.imooc;
public class Telephone {
public static void main(String[] args) {
// TODO Auto-generated method stub
Telephone phone = new Telephone();
phone.sendMessage();
phone.screen = 5.0f;
phone.cpu = 1.4f;
phone.mem = 2.0f;
phone.sendMessage();
}
}
未定义成员变量
package com.imooc;
public class Telephone {
float screen ;
float cpu ;
float mem ;
public void sendMessage(){
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Telephone phone = new Telephone();
phone.sendMessage();
phone.screen = 5.0f;
phone.cpu = 1.4f;
phone.mem = 2.0f;
phone.sendMessage();
}
}
没有定义属性吧,你就直接调方法,给赋值
Java入门第二季 升级版
530646 学习 · 6091 问题
相似问题