小编pri*_*am 的帖子

为什么这个组合代码不起作用?

我的程序显示错误"无法解析符号'getThePixels'"(在课堂上Main).代码基本上创建了一个Monitor包含Resolution类对象的类.我试图Resolution通过监视器对象访问类方法.以下是代码:

主要:

public class Main {
    Resolution resolution = new Resolution(10);
    Monitor monitor = new Monitor(12,13,14,resolution);
    monitor.getThePixels().pix();
}
Run Code Online (Sandbox Code Playgroud)

监控:

public class Monitor {
    private int height;
    private int width;
    private int length;
    Resolution thePixels;

    public Monitor(int height, int width, int length, Resolution thePixels) {
        this.height = height;
        this.width = width;
        this.length = length;
        this.thePixels = thePixels;
    }

    public int getHeight() {
        return height;
    }

    public int getWidth() {
        return width;
    }

    public …
Run Code Online (Sandbox Code Playgroud)

java methods compiler-errors

3
推荐指数
1
解决办法
78
查看次数

标签 统计

compiler-errors ×1

java ×1

methods ×1