// CS237 Concurrent Programming // ===== ========== =========== // How to set up a process by extending class Thread (SGM, 7/10/00). // First extend Thread and override its run method. // In this example the Thread method getName() is called to return the name of the current thread // which is created in the class B1 below. class A1 extends Thread{ // +----------------------------------------+ // | Code for your process goes here. | // +----------------------------------------+ public void run() { System.out.println("My name is " + getName()); } } // Now create instance(s) of class A1 and start them running. class B1 { public static void main(String [] args) { A1 x1 = new A1(); A1 x2 = new A1(); x1.start(); x2.start(); } }