When we invoke java command with -cp command then we provide some directories and jar files. Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required?
Does jvm load all the classes mentioned by the classpath Or it is just a super set of all classes which jvm will look up to load when required?
JVM loads classes form the classpath on the need basis i.e. when a reference is found for the class, it is loaded. Also there is a hierarchy of class loaders in JVM, a class loaded by the parent class loader is used by the lower class loaders.