idea快速到达末尾
The Java error message Reached End of File While Parsing results if a closing curly bracket for a block of code (e.g, method, class) is missing.
如果缺少代码块(例如,方法,类)的大括号,则会导致Java错误消息 解析时到达文件结尾。
The fix is easy — just proofread your code.
修复很容易-只需校对您的代码即可。
例 ( Example )
In the code below, the method called main does not conclude with a closing curly bracket. The compiler cannot parse the code properly and will throw the error.
在下面的代码中,称为main的方法并不以大括号结尾。 编译器无法正确解析代码,将引发错误。
public class Main {
public static void main(String[] args) {
System.out.println("Oops missed a curly bracket..");
}
避免错误 ( Avoiding the Error )
Because this error is both common and easily avoided, using a code editor like Visual Studio Code or an integrated development environment like Eclipse. Code editors that feature linters and syntax checkers for Java (or whatever language you use) will uncover errors before you attempt to compile.
因为此错误很常见并且很容易避免,所以可以使用诸如Visual Studio Code的代码编辑器或诸如Eclipse的集成开发环境。 带有针对Java(或您使用的任何语言)的linter和语法检查器的代码编辑器将在尝试编译之前发现错误。
翻译自: https://www.thoughtco.com/reached-end-of-file-while-parsing-2034285
idea快速到达末尾