Source File Structure
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 singing a only one package statement per source cod file , that\'s 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 { }