Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

Source File Structure
EHre we just focusing about Source File Structure which is the kind of import and package issues .The following legal code declares a class Foo, in package com.geeksanonymous : 
package com.geeksanonymous; // Notice the semicolon
class Foo { }
       HEre in this code its singinifes a only one package ststement per source cod file , thats are following as : 
package com.geeksanonymous;
package com.wickedlysmart; // Illegal! Only one package declaration allowed
class Foo { }
   If class Foo adds any import statement then the code is :
 package com.geeksanonymous;
import java.util.*; // Wildcard package import
import com.wickedlysmart.Foo; // Explicit class import
class Foo { }
 If the Class Foo dont have a package then the import statements must be above the
class declarationof the above code .as folows :
import java.util.*; // Wildcard package import
import com.wickedlysmart.Foo; // Explicit class import
class Foo { }
Posted By: Name:Rajesh Kr URL: Source File Structure