class ERR { static public void println(String msg){ System.err.println(Thread.currentThread().toString() + ": " + msg); } } class MyThread extends Thread { public void run() { ERR.println("Hello"); } } class Main { public static void main(String[] argv) { MyThread aThread = new MyThread(); ERR.println("this is main"); aThread.start(); // calls run() try {aThread.join();} catch (Exception e){ERR.println("Un-joinable");} finally {ERR.println("Bye");} } }