Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

runnable java

public class RunnableDemo {
  
    public static void main(String[] args) {
        System.out.println("Main thread is - " + Thread.currentThread().getName());
      
        Thread t1 = new Thread(new RunnableDemo().new RunnableImpl());
      
        t1.start();
    }
  
    private class RunnableImpl implements Runnable {
        public void run() {
            System.out.println(Thread.currentThread().getName()
                             + ", executing run() method!");
        }
    }
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #runnable #java
ADD COMMENT
Topic
Name
1+3 =