调用方法输出问题
public class Phone {
//属性
float screen;
float cpu;
float mem;
public Phone(){
System.out.println("无参构造器执行!");
}
public Phone(float newScreen,float newCpu,float newMem){
if (newScreen<3.5f) {
System.out.println("输入有误,自动赋值3.5");
screen = 3.5f;
} else {
screen = newScreen;
}
screen = newScreen;
cpu = newCpu;
mem = newMem;
System.out.println("尺寸:"+screen+"cpu:"+cpu+"mem"+mem+"有参构造器执行了");
}
}
尺寸:1.0cpu:2.0mem2.0有参构造器执行了
输出结果为什么不对了 ??帮忙给解释一下