Accessing the classes from other packages:
- We need to import other packages to access their classes.
Connecting Different Package Classes:
- ‘import’ statement is used to connect the classes of different packages.
- We can access only public class functionality from other package.
- Only public constructor is allowed to instantiate class from another package.
- Only public members are visible to access from outside package.
import:
- It is a reserved word used to connect classes of different packages.
- Import statement creates an internal pointer either “to package” or “to class”.
- Import statement loads the class only when we access its functionality.