The Deafult Package

  1. All classes that are NOT contained in any package will reside in the default package

    Example: (you have seen many of these classes before !!!)
    
        // No package specification !
    
        public class myClass // This class resides in the "default package"
        {
           int myVar;
    
           void myMethod(....);
           ....
        }
    
    

    Example: another class residing in the default package...
    
        // No package specification !
    
        public class myProgram // This class resides in the "default package"
        {
           public static void main(String args[])
           {
              // You can access myVar & myMethod DIRECTLY 
    
    	  myClass x = new myClass();
    
    	  x.myVar = 10;
    	  x.myMethod(...);
           }
        }