package demo;
public class Telephone {
float screen;
float cpu;
float mem;
public Telephone() {
System.out.println("无参的构造方法执行了!");
}
public Telephone(float newscreen,float newcpu,float newmem) {
screen=newScreen;
cpu = newCpu;
mem = newMem;
System.out.println("有参的构造方法执行了!");
}
}
public InnerClassDemo03(float newscreen,float newcpu,float newmem) {
screen = newscreen;
cpu = newcpu;
mem = newmem;
System.out.println("有参的构造方法执行了!");
}
//你在定义的时候用的都是小写,在赋值的时候变成了大写。
一般两个字母组合的第二个字母大写
screen=newScreen;
cpu = newCpu;
mem = newMem;
newScreen改成newscreen其他同理
构造函数的参数打错了,没有大写,public Telephone(float newScreen,float newCpu,float newMem) {