Home Segments Top Top Previous Next

646: Mainline

Another way to bring together classes into modules is to place them in single-class compilation units, which you then bring together into a common package, using a package statement at the beginning of each such compilation unit. In general, the package names that appear in package statements consist of components separated by dots:

package onto.java.entertainment;        
public abstract class Attraction { 
 // Remainder of class definition 
} 

package onto.java.entertainment;        
public class Movie extends Attraction { 
 // Remainder of class definition 
} 

package onto.java.entertainment;        
public class Symphony extends Attraction { 
 // Remainder of class definition 
} 

package onto.java.entertainment;        
import java.io.*; 
import java.util.*; 
public class Auxiliaries { 
 // Remainder of class definition 
}