Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图通过在主类中编写 main(String[]) : void 在 Eclipse 中执行 hello world 代码,但它说错误:无法找到或加载主类 main(String[]) : void。
您提供的只是 Java 程序的一个残缺片段。您还没有完全定义一个类。最基本的 Java 程序如下所示:
public class filename{ public static void main(String[] args){ System.out.println("Hello, World!"); } }
将此作为每个项目的最低要求,并参考 Oracle 的 Java 文档。