class phone{
private int cpu;
public void setCpu(int x){
this.cpu=x;
}
public int getCpu(){
return this.cpu;
}
}
class smartphone extends phone{
setCpu(2);/*problem*/
int num=getCpu();
public void out()
{
System.out.println(num);
}
}
public class telphone{
public static void main(String[] args){
smartphone s1 = new smartphone();
s1.out();
}
}
问题出在注释的那一行 怎么通过setCpu修改cpu的值呢
相关分类