What are the steps performed while loading a Java class?


Ans: Phases of class loading

The are three phases of concrete class loading: physical loading, linking, and initializing.


1) In in first phase of physical loading required class file will be searched in specified classpaths. If the file is found it is read and the bytecode is loaded. This process gives a basic memory structure to the class object, such concepts like methods, fields, and other referenced classes are not known at this stage.

2) Linking can be broken down into three main stages, because it is complex phase:
1.Bytecode verification through class loader, which executes a number of checks on the bytecodes.
2.Class preparation. This stage prepares the necessary data structures that represent fields, methods and implemented interfaces that are defined within the class.
3.Resolving of all the other classes referenced by a particular class. The classes can be referenced in a number of ways:
Superclasses
- Interfaces
- Field types
- Types in method signatures
- Types of local variables used in methods

3) During the initializing phase any static initializers contained within a class are executed so that, static fields are initialized to their default values.
It is interesting, that class loading can be performed in a lazy manner and therefore some parts of the class loading process may be done on first use of the class rather than at load time.

People who read this post also read :



11 comments:

I like java programming, this blog is very helpful.
SEO Company in Lucknow

I like java programming, this blog is very helpful.
SEO Company in Lucknow

Thank you for listing your services here. They might be useful for many seekers, who are after learning java. Professional Web design services are provided by W3BMINDS- Website designer in Lucknow.
Web development Company | Web design company

nice article !!but java is so difficulty right and now-a-days online marketing like digital marketing is in boom and it is providing by the best institute like 360DigiTMG located at Hyderabad

Lucknow Best Web Design, Development and SEO Company in Lucknow, India, US, UK is Providing Best Website Design, Development and SEO Services.

I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also
https://sugardefender-en.com/

It was very useful for me. Keep sharing such ideas in the future as well.
https://javaburn-eng.com/

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More