Message.java Source code

Java tutorial

Introduction

Here is the source code for Message.java

Source

class Message extends Thread {

    public void run() {
        System.out.println("Bye.");
    }
}

public class Main {

    public static void main(String[] args) {
        try {
            // register Message as shutdown hook
            Runtime runTime = Runtime.getRuntime();
            runTime.addShutdownHook(new Message());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}