How To Load A Class Using Class.forName()

java-thumbnail

This example shows how to load a class using the Class.forName() method. All the classes in your application or dependent class files are loaded by appropriate class loader prior to using in the application. By default, class files are loaded by JVM when first time accessed by the applications. However, in certain situations you have […]

How To Get Class Loaded Path

java-thumbnail

This example illustrates how to get the class loaded path. If you are aware of the java.lang.Class, it has methods for knowing the details of a class. There are many details this object can reveal us, one of the method defined in that class is Class.getProtectionDomain() which is useful for getting the source code path […]

How To Get Implementing Interfaces Name For A Class

java-thumbnail

This example illustrates how to get the implemented interfaces names of a particular class. If you are aware of the java.lang.Class, it has methods for knowing the details of a class. One of the method defined in that class is Class.getInterfaces() which is useful for getting all the interfaces names which it is implemented. This […]

How To Get Super Class Name From Object

java-thumbnail

This example illustrates how to get the super class name from its instance. If you are aware of the java.lang.Class, it has methods for knowing the details of a class. One of the method defined in that class is Class.getSuperclass() which is useful for getting the super class’s java.lang.Class object. With that object, you can […]

How To Get Class Name From Object

java-thumbnail

This example illustrates how to get the class name from its object. If you are aware of the java.lang.Class, it has methods for knowing the details of a class. One of the method defined in that class is Class.getName() which is useful for getting the name of the class. Note that, each instance has “class” […]