user2037661
user2037661

Reputation: 51

if two libraries have classes that have the same class& package name for their internal use

I have two jars that have the same package structure. And they have a class that have the same name. like..

lib1.jar
   - A.class
   - Same.class
lib2.jar
   - B.class
   - Same.class

Actually, I don't use Same.class but it is used by class A and B

Then, what happened?

If lib1.jar is loaded first, only Same.class in lib1.jar is used for both A.class and B.class?

or A & B will use different Same.class in their own jar?

Upvotes: 2

Views: 2989

Answers (1)

BHAWANI SINGH
BHAWANI SINGH

Reputation: 729

If there isn't any special Class loader , which loads different classes at run time, the class loaded first will be used in both the places. Please check this for more info.

Upvotes: 1

Related Questions