import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
    public static void main(String[] args) {
        Thread t = Thread.currentThread();
        System.out.println("current thread: " + t);
        t.setName("my thread");
        System.out.println("after name change: " + t);
        
        try {
            for (int n = 5; n > 0; n--) {
                System.out.println(n);
                Thread.sleep(100);
            }
        } catch (InterruptedException e) {
            System.out.println("interrupted");
        }
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: