Reputation: 185
I'm playing around with Java.
Consider I am writing a class named:
AA.java
under package name SoUnique
.
And my friend comes with a package name AnotherUniqueName
which includes a file name AA.java
.
How can I use his methods in his package? Does my example make sense at all? Should I import anything? How does packaging help to avoid conflicting names?
Upvotes: 1
Views: 241
Reputation: 37073
use fully qualified package name (assuming it has myfun method) like:
AnotherUniqueName.AA.myfun();
Upvotes: 9
Reputation: 1331
If you want to call a non static method you can create object and call your method.
AnotherUniqueName.AA obj=new AnotherUniqueName.AA();
obj.yourMethod();
Upvotes: 2