4.11. Composition of the main Method

Let's take a moment to look at the now familiar main method and break it apart to see how it is composed. The purpose of the main method is to have a starting place for programs to execute. So far all of the code we have written has been confined to one class file. As our programs grow in complexity, we will define different classes distributed in different files to handle particular aspects of the programs' work.

public static void main(String[] args)  {

The main method is declared public. That means that it is accessible by other classes. It is also static. Remember that static methods are called on a class, not on an object. main is necessarily static because at the start of a program's execution, ...

Get Java™ for ColdFusion® Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.