Home >Java >javaTutorial >Tv task
Using created instance, call watch() method.
public class Tv {
public static void main(String[] args) {
// TODO Auto-generated method stub
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(); }
}
out put watching tv
The above is the detailed content of Tv task. For more information, please follow other related articles on the PHP Chinese website!