基本上,我试图在intro()方法中调用myMap,但我无法弄清楚它为什么不起作用。我的IDE说“非静态字段不能从静态上下文中引用”但我已经尝试将新的myMap内容放在多个地方但它仍然不起作用。请帮忙!
import java.util.Scanner;
public class MazeRunner {
Maze myMap = new Maze ();
public static void main ( String [] args ) {
intro();
}
public static void intro() {
Scanner input = new Scanner(System.in);
System.out.println("Welcome to Maze Runner!");
System.out.println("Here is your current position:");
myMap.printMap();
}
}