Popular Posts

Monday, June 13, 2011

Java - Class loaders



ClassLoaders

Ø Class loaders are hierarchical.

Ø Classes are introduced into the JVM as they are referenced by name in a class that is already running in the JVM.

Ø Class loader creates a namespace.

All JVMs include at least one class loader that is embedded within the JVM called the primordial (or bootstrap) class loader.

Ø API

===

A class loader is an object that is responsible for loading classes.

class ClassLoader is an abstract class.

Given the binary name of a class, a class loader should attempt to locate or generate data that constitutes a definition for the class. A typical strategy is to transform the name into a file name and then read a "class file" of that name from a file system.



how is the very first class loaded?

The very first class is especially loaded with the help of static main( ) method declared in your class. All the subsequently loaded classes are loaded by the classes, which are already loaded and running.

Class loaders are hierarchical and use a delegation model when loading a class. Class loaders request their parent to load the class first before attempting to load it themselves. When a class loader loads a class, the child class loaders in the hierarchy will never reload the class again

Classes loaded by a child class loader have visibility into classes loaded by its parents

Explain static vs. dynamic class loading?



No comments:

Post a Comment