意外的标识符 return 没有可预见的原因

unexpected Identifier return for no forseeable reason

我不确定这里发生了什么我在我的第一行代码中不断收到一个意外的标识符 return 但我不知道发生了什么是我的代码有问题还是它我的编译器?

private static final float IDEAL_FRAME_RATE = 100;

KeyInput currentKeyInput;
GameSystem system;
PFont smallFont, largeFont;
boolean paused;

void setup() {
  size(1360, 640, P2D);
  frameRate(IDEAL_FRAME_RATE);

  // Prepare font
  final String fontFilePath = "Lato-Regular.ttf";
  smallFont = createFont(fontFilePath, 20f, true);
  largeFont = createFont(fontFilePath, 96f, true);
  textFont(largeFont, 96f);
  textAlign(CENTER, CENTER);

  rectMode(CENTER);
  ellipseMode(CENTER);

  currentKeyInput = new KeyInput();

  newGame(true, true);  // demo play (computer vs computer), shows         instruction window
}

void draw() {
  if(keyIsDown(72))
    println("H");
  background(255f);
  background(random(255), random(255), random(255));
  system.run();
}

void newGame(boolean demo, boolean instruction) {
  system = new GameSystem(demo, instruction);
}

void mousePressed() {
  system.showsInstructionWindow = !system.showsInstructionWindow;
}

还有其他六个 类 与这个一起使用 如果这个没有任何问题会不会是另一个女孩造成的?如果我需要 link 那么我会很高兴因为我被困住了并且真的很想完成它

Java 没有像 VB 那样的模块(至少我上次检查时是这样)。所以我猜你缺少 class 语句来包装你的代码。

public class SomeClass {
   //...
}

https://docs.oracle.com/javase/tutorial/java/javaOO/classes.html

既然你现在提到这是在处理中,请参阅 https://en.wikipedia.org/wiki/Processing_(programming_language) 它提到不允许使用“静态”(您在第一行的 IDEAL_FRAME_RATE 处有它,这可以解释您收到的错误消息)

Every Processing sketch is actually a subclass of the PApplet[3] Java class (formerly a subclass of Java's built-in Applet) which implements most of the Processing language's features.

When programming in Processing, all additional classes defined will be treated as inner classes when the code is translated into pure Java before compiling. This means that the use of static variables and methods in classes is prohibited unless Processing is explicitly told to code in pure Java mode.

Processing also allows for users to create their own classes within the PApplet sketch. This allows for complex data types that can include any number of arguments and avoids the limitations of solely using standard data types such as: int (integer), char (character), float (real number), and color (RGB, ARGB, hex).