DEV Community

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

Posted on

1 1 1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs