Do I need to import java.lang package any time? Why? Or Which package is always imported by default? No. It is by default loaded internally by the JVM. The java.lang package is always imported by default. Can I import same package/class twice? Will the JVM load the package twice at runtime? One can import the same package or same class multiple times. Neither compiler nor JVM complains anything about it. And the JVM will internally load the class only once no matter how many times you import the same class. Does importing a package imports the sub packages as well? E.g. Does importing com.bob.* also import com.bob.code.*? No you will have to import the sub packages explicitly. Importing com.bob.* will import classes in the package bob only. It will not import any class in any of its sub package’s. What is a Java package and how is it used? Or Explain the usage of Java packages. A Java package is a naming context for classes and interfaces. A package is used to create a se...
About Java and it's related concepts..