There was an error in this gadget

Wednesday, July 2, 2008

The Basic Program Skeleton

The basic skeleton of a Java application goes as follows:

public class YourProgramName{
public static void main(String arg[]){

Your Program Goes Here

}
}

YourProgramName gets replaced by your actual program's name. The program must be stored in a file named YourProgramName.java

The actual code for your program goes in place of Your Program Goes Here.

More complicated programs have more to them than this. For example, you should have your own classes in their own files that contain most of your program logic if you are writing a long program. But this is the most direct and basic structure for a Java program.

The word arg can be whatever you choose to make it, by the way. If your program needs to get information from the system environment, just make sure that the name is the same as what you use in your program.
StumbleUpon