ThreadDemo.java Source code

Java tutorial

Introduction

Here is the source code for ThreadDemo.java

Source

class ThreadDemo extends Thread {
    public void run() {
        System.out.println("Thread priority = " + getPriority());
    }
}

public class Main {
    public static void main(String args[]) {
        Thread t = new Thread(new ThreadDemo(), "java2s.com thread");
        t.setPriority(1);

        System.out.println("thread  = " + t);

        t.start();
    }
}