Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Relation between "new" operator and "ClassLoader" class ?

  Asked By: Manju    Date: Jun 04    Category: Java    Views: 1332
  

What is the relation between the "new" operator and the "ClassLoader" class?
The new operator uses a classLoader to load the class?

I want that when I call: new MyClass() my classLoader execute and load
the class?

I can extend ClassLoader with my own ClassLoader.
The question is when the class loader is invoked .. ?

1) new MiClass()

2) Class.forName("MiClass").newInstance()

3 )ClassLoader myClassLoader = new MyClassLoader()
myClassLoader.loadClass ( "MyClass" ).newInstance()

We can set the classLoader to the current thread :
Thread.currentThread().setContextClassLoader( myClassLoader );
But when this classloader is executed ?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Relation between "new" operator and "ClassLoader" class ? Or get search suggestion and latest updates.




Tagged: