Source File Organization

File organization in Java is a bit different than in other languages (e.g., C or C++). The name of the file corresponds to the name of the class file generated by the compiler (at one time, only one public class could be defined per source file).

See Java Code Conventions for a more detailed description on Java coding conventions.


// file name, e.g., Org.java

// header/other pertinent information 

   //  "Package" declaration
package myPackage;

   //  "System" imports
import java.awt.*;
import java.applet.Applet;
import java.lang.Math;

   //  "User-defined" imports 
import special_pkg.io.*;


   //  main
public class Org extends Applet
{
   //  class variables/constants

   //  instance variables

   //  constructors

   //  class functions

   ....     //  main program (top for applications)
}


Home