// Thread1.java // Simple thread example that subclasses Thread. // Also shows how to call setPriority() // by Mark Allen Weiss, revised by Kip Irvine // Updated 1/21/2003 import java.lang.Thread; class MyThread extends Thread { public void run( ) { for( int i = 0; i < 50; i++ ) System.out.println( "MyThread " + i ); } } class ThreadDemo { public static void main( String[] args ) { Thread t1 = new MyThread( ); t1.setPriority( Thread.NORM_PRIORITY ); // default //t1.setPriority( Thread.MAX_PRIORITY ); // set to max t1.start( ); for( int i = 0; i < 50; i++ ) System.out.println( "main thread " + i ); } }