Home Segments Top Top Previous Next

27: Mainline

All Java programs contain one or more class definitions, each of which may contain various method definitions.

In particular, every standalone Java program must contain a class definition that defines a method named main. When you start a Java program, the Java virtual machine performs the computations specified in the main method, thereby executing your program.