Do I need to import java.lang package any time? Why?

Solution:

There are two ways to access a class in another class.

  • By using the fully qualified name: To access a class in a different package, either we must use the fully qualified name of that class, or we must import the package containing that class.
  • By using the relative path , We can use the path of the class that is related to the package that contains our class. It can be the same or subpackage.
0 answers