Exception in thread “main” java.lang.Error: Unresolved compilation problems:
Syntax error on token “;”, { expected after this token
Syntax error, insert “}” to complete Block
Java编译错误
检查半天才发现是没有将for语句写在方法中,
if、for语句代码一定要写在方法或代码块中,否则实例化后无法执行,编译器会认为你少了一个大括号。
Java编译错误
放到构造方法中后就不报错了。

相关文章:

  • 2022-12-23
  • 2021-12-28
  • 2022-01-04
  • 2021-08-17
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2022-01-27
  • 2021-10-25
  • 2021-05-20
  • 2022-12-23
相关资源
相似解决方案