What happens when a class is loaded in Java?
When a class is loaded, the JVM checks the classpath and then simply prepares it for execution without initializing it immediately.
Thatâ€™s partially correct. While class loading prepares the class, it does not initialize it until required, but initialization happens when the class is actually used.
Can you explain how the JVM initializes a class and when the static blocks are executed?