package com.imooc;
public class Telphone {
private float screen;
private float cpu;
private float mem;
public void sendMessage(){
System.out.println("sendMessage");
}
public float getScreen() {
return screen;
}
public void setScreen(float screen) {
this.screen = screen;
// this.sendMessage();
}
public float getCpu() {
return cpu;
}
public void setCpu(float cpu) {
this.cpu = cpu;
}
public float getMem() {
return mem;
}
public void setMem(float mem) {
this.mem = mem;
}
public Telphone(){
System.out.println("无参的构造方法执行了!");
}
public Telphone(float newScreen,float newCpu,float newMem){
if(newScreen<3.5f){
System.out.println("你输入的参数有问题,自动赋值3.5");
screen = 3.5f;
}else{
screen = newScreen;
}
screen = newScreen;
cpu = newCpu;
mem = newMem;
System.out.println("有参的构造方法执行了!");
}
}
我加黑的部分 为什么没有输出, 希望有人能为我解答一下,谢谢
qq_20151109_0
_夕晨踏雪
相关分类