How the JVM recognizes the classes of same name with having same name constructor located in different packages say eg: pack1,pack2 ?
e.g:
1) In pack1:-
import pack1;
class A{
void A(){
System.out.println("pack1");
}
}
2) In pack2:
class A{
void A(){
System.out.println("pack2");
}
}
And now I calling both in main....
class callPack{
public static void main(
String args[]){
A a=new A();
a.A();
}
}
If any syntax mistake in packages is there rectify plz.....
Here by question is how the a member variable calls the methods/constructors with single Instance/reference to both packages?
Here doesn't it require another one to call? If it doesnt need how it shares the Object? And what percentage of each packages share the object?