how to import packages from source packages java code example
Example 1: java import
import java.util.* //imports entire utility package
import java.util.scanner // imports just the scanner object
public class CheeseBurgerOrderer {
public static void main(String[] args) {
// code body
}
}
Example 2: Can we define package statement after import statement in java
We can’t define package statement after import statement in java.
package statement must be the first
statement in source file. We can have comments before the package statement