0

I was trying to execute the hello world code in Eclipse by writing main(String[]) : void in main class, but it said Error: Could not find or load main class main(String[]) : void.

  • 1
    You forgot the variable name `args` that should come after `String[]`. BTW, when you post a question you should post your code as well. – Nir Alfasi Jan 11 '15 at 02:33

1 Answers1

0

What you've provided is only a broken fragment of a Java program. You have not fully defined a class. The most basic Java program looks like this:

public class filename{

    public static void main(String[] args){
        System.out.println("Hello, World!");
    }

}

Use this as a bare minimum for every project, and refer to Oracle's Java documentation.

RutledgePaulV
  • 2,568
  • 3
  • 24
  • 47
DripDrop
  • 994
  • 1
  • 9
  • 18