运行结果怎么都是0.0呢???
public class three1 {
float LED;
float mem;
float CPU;
//public three1(){
// System.out.println("无参的构造方法执行了");
//};
public three1(float newLED,float newMem,float newCPU){
if (LED < 3.5f){
newLED = 3.5f;
System.out.println("自动赋值为:3.5");
}
else{
newLED=LED;
}
newMem = mem;
newCPU = CPU;
System.out.println("有参的构造方法执行了"+"LED:"+newLED+"mem:"+newMem+"CPU:"+newCPU);
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
//three1 fun = new three1();
three1 fun2 = new three1(4.0f,4.5f,6.4f);
}
自动赋值为:3.5
有参的构造方法执行了LED:3.5mem:0.0CPU:0.0