Ashish:
Will this call not try to load class C using current loader (if not already loaded) and create an object for it? How can I force that class C, loaded by loader2 should be used?
When using the new operator, only the classloaders in the current hierarchy will be searched.
So, if you are using classloader CL2 whose parent is CL1 and the above code is executed from a class with the classloader as CL2, then both CL2 and CL1 will be searched for the class definition (Although if the class definition is available with CL1, CL2 will not be searched.).
The order of searching(delegation model) is top down i.e. from the parent to the child.
However, if you want to explicitly use a classloader which will not be used according to the above rules, then you can use reflection(
Class.forName()) to explicitly use a classloader instance.