我的程序显示错误"无法解析符号'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)