When i use java -verbose:class command to run a class file, why is it that some classes not being mentioned in the import statements and not used in the .java file are getting loaded? Or is it that all the class files present in the jar(rt.jar in this case) would be loaded no matter what all classes are being used in the java program ?
A few classes are used by the JVM itself and are always loaded; those classes depend on a few others, which are thus also loaded. These include things like Object, System, Thread, String, Class, Cloneable, Serializable, Comparable, Throwable, Exception, Error, RuntimeException, etc, etc.
Then there are the classes that your class uses, and the classes that these other classes depend on... this can turn out to be quite a few classes altogether. Things like PrintStream, and and many classes that it relies on from java.io.
In any case, no, Java doesn't load everything in rt.jar, only the classes that are needed. Loading every single class in rt.jar would take quite a long time!