Follow these steps to implement the example:
- Create a class named Operations:
public class Operations {
- Implement a public static method named readData(). It puts the current thread to sleep for 500 milliseconds:
public static void readData(){ try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }
- Implement a public static method named writeData(). It puts the current thread to sleep for 500 milliseconds:
public static void writeData(){ try { TimeUnit.MILLISECONDS.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }
- Implement a public static method named processData(). It puts the current thread to sleep for 2,000 milliseconds:
public ...