Skip to main content

Posts

Showing posts with the label InterruptedException

Thread Basics

Thread Basics 1-       Thread Creation : There are two ways of creating a new thread. Way-1 Implementing Runnable Interface: public class CustRunnable implements Runnable {     public void run () {         System . out . println ( "Executed !" );     }     public static void main ( String args []) {         Thread myThread =   new Thread ( new CustRunnable ());         myThread . start ()     } } Way-2 Extending Thread Interface: public class CustThread extends Thread {     public void run () {         System . out . println ( "Executed from a new thread!" );     }     public static void main ( String args []) {      ...