DEV Community

V I N O T H
V I N O T H

Posted on

Task 2

Task 2:

  1. Create a class called WashingMachine
  2. Have below method in it. public void wash() { System.out.println("Washing Clothes"); }
  3. Save and Compile this class.
  4. Create another class called Human with main method.
  5. Inside main method, create an instance for WashingMachine class.
  6. Using created instance, call wash() method.

Input:

Image description

Image description

Output:

Image description

Top comments (0)