package com.equals;
public class Telephone1 {
public float screen;
public float cpu;
public float mem;
public Prime(float newScreen,float newCpu,float newMem ){ //报错Return type for the method is missing 可是我想建立的不是 构造方法吗? 这样不正确吗?
screen=newScreen;
cpu=newCpu;
mem=newMem;
}
}
构造方法,必须和类同名:
public Telephone1(float newScreen,float newCpu,float newMem ){
screen=newScreen;
cpu=newCpu;
mem=newMem;
}
构造方法,必须和类同名:
public Telephone1(float newScreen,float newCpu,float newMem ){
screen=newScreen;
cpu=newCpu;
mem=newMem;
}
首先构造方法必须与类同名