為什么這個代碼一直顯示error
package exercise1;
public class Staff {
float screen ;
float cpu;
float mem;
public Staff(float newScreen,float newCpu,float newMem) {
screen = newScreen;
cpu = newCpu;
mem = newMem;
System.out.println("有參的構造方法");
}
}
package exercise1;
public class player {
public static void main(String[]args) {
Staff staff = new Staff();
new Staff(5.0f,1.4b,3.0g);
}
}
2020-06-04
5.0? , 1.4 , 3.0后邊的那個字母f是代表float,表示單精度
2020-04-19
........ 正確寫法是 Staff staff=? new? Staff( 5.0f, 1.4f,3.0f);? ?