Thread , Runnable and ExecutorService
Previous approach to create a thread. 1. Directly create an object of Thread Class after overriding the public void run() method of Thread class and call the start method to initiate the thread package com.executor; public class OldThread implements Runnable { private String task ; public OldThread() { super (); } public OldThread(String task ) { super (); this . task = task ; } @Override public void run(){ System. out .println( " Old thread runnable " + this . task ); try { Thread. sleep (2000); } catch (InterruptedException e ) { e .printStackTrace(); } System. out .println( this . task + " completed." ); } } 2. Implement the Runnable interface and override the public void method and pass the reference of Runnable Object reference into Thread(Runnable) constructor. call the start method to initiate the thread package com.executor; public cl...