# 36 ClassLoading | Class Loaders | Type of ClassLoading & Loaders | Tutorial In Java Tutorials

preview_player
Показать описание
For Online Live Training Contact me directly on - 9310683500 (Available on What's App Also)
Class loading: -
It is the process of storing the class specific information into memory (i.e. data member, member function, constructor etc.) this process is done by class loaders. (They are the software program).
Type of Class Loaders: -
2. extension class loader (jre/lib/ext)
3. Application class loader (environment variable)
Things done at class loading time:
• Memory is allocated to the Static Data member.
• Default values are initialized to the Static Data Member.
• Static Block are executed in given order
Types of Class Loading:
1. Static class loading
2. Dynamic class loading.
In case of static class loading compiler have already knowledge about loaded class but in case of dynamic class loading compiler does not have the knowledge about loaded class.
Condition of static class loading: -
1. When we run any class.
2. When we are creating the object of a class into another class.
3. When we are inheriting one class into another class.
4. When we call any static members of a class.
Condition of static class loading: -
In java there is a class whose name is Class and this class Class have a static method called forName() which is responsible for dynamic class loading?

Command Line Arguments: -It is the process of passing the values from command line at run time.
In java there is a class whose name is Class. Every class is the instance of class Class.When any class statically or dynamically loaded into memory then JVM creates object of class Class for the loaded class. Then class Class object is the duplicate copy (reflected image) of specific loaded class. It is the part of reflection API.

How many ways are there to get the object of class Class:
1. When we call the getClass() method of object class on the target class object.
Class A
{
Public static void main(String ss[])
{
A a=new A();
}
}

2. When we load a class dynamically using the static method forName() of class Class then it return the object of class Class.

3. Directly.

About forName() method: -
1. This is the static method of class Class.
2. There are mainly two uses of this method
a) To load a class dynamically
b) Return the class Class object of the loaded class.
//signature of forName()

Public static Class forName(String nameOfClass)

About newInstance() method: -
1. This is the non-static method of class Class whose main purpose is to create the object of any class at runtime.
2. This is another way to create the object of a class.

Stay tuned with me for more upcoming Videos,
don't forget to subscribe my YouTube Channel and share your valuable comments in Comment section down below, i'll be happy t o help you all, your Surya ☺

Connect on Socials:-

#ClassLoading #ClassLoaders #LoadersTypes

java Basic Java Tutorial for beginners
Basic Java Programming for beginners
Рекомендации по теме
welcome to shbcf.ru