Extending the Thread class
One way to create a thread is to extend the java.lang.Thread
class and override its run()
method. Here’s an example of this:
class MyThread extends Thread {
    private String parameter;
    public MyThread(String parameter) {
        this.parameter = parameter;
    }
    public void run() {
        while(!"exit".equals(parameter)){
           System.out.println((isDaemon() ? "daemon"
              : "  user") + " thread " + this.getName() +
              "(id=" + this.getId() + ") parameter: " +...