运行结果为什么全是0.0?
package com.fgs;
public class InitailTelephone {
public static void main(String[] args) {
Phone p = new Phone();
Phone p1 = new Phone(5.0,2.5,4);
}
}
**************************************************
public class Phone {
private double screen;
private double cpu;
private double mem;
public Phone() {
System.out.println("无参构造");
}
public Phone(double screen,double cpu,double mem){
screen = this.screen;
cpu = this.cpu;
mem = this.mem;
System.out.println("屏幕"+screen+"cpu"+cpu+"内存"+mem);
}
}
输出结果:
无参构造
屏幕0.0cpu0.0内存0.0