ThreadDemo.java Source code

Java tutorial

Introduction

Here is the source code for ThreadDemo.java

Source

class ThreadDemo extends Thread {

    public void run() {

        // returns the context ClassLoader for this Thread
        ClassLoader c = getContextClassLoader();

        // sets the context ClassLoader for this Thread
        setContextClassLoader(c);
        System.out.println("Class = " + c.getClass());
        System.out.println("Parent = " + c.getParent());
    }

}

public class Main {

    public static void main(String args[]) {

        ThreadDemo t = new ThreadDemo();
        // this will call run() function
        t.start();
    }
}