• Post Reply Bookmark Topic Watch Topic
  • New Topic

Initialization of a class if it loaded by two different classLoaders  RSS feed

 
narendra saran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose i have a class called 'MyClass' and if i load it through two different classLoaders then there will be two different Class Objects in different namespaces for this single class, right?. Now my question is how many times the initialization of 'MyClass' will happen: only once or two times(one for each namespace).It would be better if you provide some demo code along with.
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each of the two classes will be initialized when they are loaded. They are separate classes and the fact that they happen to have the same name (but not the same classloader) is irrelevant to that.
 
narendra saran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks paul
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!