0 votes
in JAVA by
How can we access some class in another class in Java?

1 Answer

0 votes
by

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.

Related questions

0 votes
asked Jan 24, 2021 in JAVA by rajeshsharma
+1 vote
asked May 5, 2021 in JAVA by SakshiSharma
...