Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("java.lang.String");
        // returns the ClassLoader object associated with this Class.
        ClassLoader cLoader = cls.getClassLoader();

        if (cLoader == null) {
            System.out.println("The default system class was used.");
        } else {
            // returns the class loader
            Class loaderClass = cLoader.getClass();
            System.out.println(loaderClass.getName());
        }
    }
}