Classloading and initialization in Java
Understanding of when a class is loaded and initialized in JVM is one of the fundamental concept of Java programming language. Thanks to Java language specification we have everything clearly documented and explained, but many Java programmer still doesn't know when a class is loaded or when a class is initialized in Java. Class loading and initialization seems confusing and complex to many beginners and its true until having some experience in belt its not always easy to get into subtle details of How JVM works in Java. In this Java tutorial we will see when class loading occurs in Java and when and how class and interface are initialized in Java. I will not go into detail of ClasLoader or How ClassLoader works in Java, that is subject of another post I am planning. just to keep this article focused and concise. There are several articles on Java fundamentals in Javarevisited like How HashMap works in Java and How Garbage collection works in Java. If you are interested you can also check those.