请问这个怎么简化

来源:7-1 什么是 Java 中的封装

qq_龙之子_1

2018-07-17 16:37

private float scerr;

private float cpu;

private float mem;

public float getScerr(){

return scerr;

}

public float getCpu(){

return cpu;

}

public float getMem(){

return mem;

}

public void setScerr(float newScerr){

scerr =newScerr;

}

public void setCpu(float setCpu){

cpu =setCpu;

}

public void setMem(float setMem){

mem =setMem;

}


写回答 关注

1回答

  • 慕慕3157912
    2018-07-17 17:12:26

    private float scerr;

    private float cpu;

    private float mem;


    public float getScerr(){

    return scerr;

    }

    public float getCpu(){

    return cpu;

    }

    public float getMem(){

    return mem;

    }

    public void setScerr(float scerr){

    this.scerr =scerr;

    }

    public void setCpu(float cpu){

    this.cpu =cpu;

    }

    public void setMem(float mem){

    this.mem =mem;

    }


Java入门第二季 升级版

课程升级!以终为始告别枯燥,在开发和重构中体会Java面向对象编程的奥妙

530655 学习 · 6091 问题

查看课程

相似问题