DEV Community

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

Posted on

Day8 task 1

Task 1:

  1. Create a class called TV
  2. Have below method in it. public void watch() { System.out.println("Watching TV"); }
  3. Save and Compile this class.
  4. Create another class called Viewer with main method.
  5. Inside main method, create an instance for TV class. (Instance - object)
  6. Using created instance, call watch() method.

Input;

Image description
Image description

Output;

Image description

Top comments (0)