Package creation in Java | Java Online Tutorials
This Java Online Tutorials “Package creation in Java” post explains clearly how to create package and how to compile source code which contains package statement in java.
Create User Package in Java:
- ‘package’ is a keyword used to create user packages in Java.
- ‘package’ statement must be placed at the top of java source file.
- ‘import’ statements followed by package statement in java file.
package creation in java
package nit ;
import java.lang.String ;
import java.lang.System ;
public static void main(String args)
Compile source file which contains package statement:
- It is different to compile source file which contains package statement.
- ‘-d’ is used to create package if package doesn’t exists.
- Compiler is responsible for creating required package in the given path to generate class file.