Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In Java, everything goes in a class. You’ll type your source code file (with a .java extension), then compile it into a new class file (with a .class extension). When you run your program, you’re really running a class.
Running a program means telling the Java Virtual Machine (JVM) to “Load the MyFirstApp class, then start executing its main() method. Keep running ‘til all the code in main is finished.”
In Chapter 2, we go deeper into the whole class thing, but for now, all you need to think is, how do I write Java code so that it will run? And it all begins with main().
The main() method is where your program starts running.
No matter how big your program is (in other words, no matter how many classes your program uses), there’s got to be a main() method to get the ball rolling.