DEV Community

hema latha
hema latha

Posted on

Tv task

1.create a class called TV
2.Have below method in it.
public void watch()
{
System.out.println("Watching TV");

}
Enter fullscreen mode Exit fullscreen mode

Create another class called Viewer with main method.
Inside main method, create an instance for TV class. (Instance - object)
Using created instance, call watch() method.

public class Tv {

public static void main(String[] args) {
    // TODO Auto-generated method stub
Enter fullscreen mode Exit fullscreen mode

Tv LG = new Tv();
LG.Watch();
}
public void Watch ()
{
System.out.println("watching tv");
}
}

public class Viewer {

public static void main(String[] args) {
    // TODO Auto-generated method stub
       Tv LG = new Tv();
       LG.Watch();}
Enter fullscreen mode Exit fullscreen mode

}

out put --- watching tv

}

Top comments (1)

Collapse
 
zentinabidh profile image
zentinabidh

Yacine TV v3 is a popular streaming app that offers live sports, movies, and TV channels, especially catering to football fans. With an easy-to-use interface and smooth streaming, it provides access to various international and Arabic channels. The latest version, Yacine TV v3, enhances performance with better stability and fewer ads, making it a great choice for uninterrupted entertainment on Android devices.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay