為什么會(huì)顯示The value of the local variable phone2 is not used?
為什么會(huì)顯示The value of the local variable phone2 is not used? 而且在Telphone.java中,private 的三個(gè)變量也是顯示The value of the field Telphone.screen is not used
為什么會(huì)顯示The value of the local variable phone2 is not used? 而且在Telphone.java中,private 的三個(gè)變量也是顯示The value of the field Telphone.screen is not used
2015-08-22
舉報(bào)
2015-08-25
你定義的screen,cpu,mem都是私有屬性,不能直接用對(duì)象.私有屬性,要不你就把私有屬性改成公有屬性,要不你就寫(xiě)get和set方法
2015-08-24
package com.imooc;
import com.imooc.Telphone;
public class InitalTelphone {
?? ?public static void main(String[] args) {
?? ??? ?Telphone phone = new Telphone(5.0f,2.0f,16.0f);
?? ?}
}
package com.imooc;
public class Telphone {
?? ?private float screen;
?? ?private float cpu;
?? ?private float mem;
??? ......
}
我的代碼是這樣的,對(duì)象名phone,和三個(gè)變量名 都提示 The value of the field Telphone.screen is not used;...
2015-08-24
代碼?