Here are couple of possible erroneous modifications to the HelloWorld
program.


First, this version moves the "main" method outside of the block of
the definition of the HelloWorld class:

	class HelloWorld {
	}

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

The compiler will reject this version with error messages like this:

	HelloWorld.java:4: Identifier expected.
	public static void main(String[] args) {
	      ^
	HelloWorld.java:4: 'class' or 'interface' keyword expected.
	public static void main(String[] args) {
	       ^
	2 errors

Unlike C or C++, Java "functions" cannot exist outside the scope of a
class definition.


This version with the static keyword removed from the definition of
the main method:

	class HelloWorld {
	    public void main(String[] args) {
		System.out.println("Hello, world");
	    }
	}

will compile successfully but will produce this error message when
executed:

	In class HelloWorld: main must be public and static

The signature for the "main" method of a class used in the role of
starting up an application (e.g., giving the class name to the java
interpreter command) must have the exact signature as that in the
original HelloWorld program: it must be public, static, have no return
value (void), and it must take one parameter, and array of String
objects.
