Ques
**
1.Create a class called TV
2.Have below method in it. public void watch() { 3.System.out.println("Watching TV"); }
4.Save and Compile this class.
5.Create another class called Viewer with main method.
6.Inside main method, create an instance for TV class. (Instance - object)
7.Using created instance, call watch() method.
**
INPUT:1
class Tv
{
public void seeing()
{
System.out.println("Watching TV");
}
}
INPUT:2
class Viewer
{
public static void main(String[]args)
{
Tv child=new Tv();
child.seeing();
}
}
Top comments (0)