Java Course

class Tree
{
public void myName()
{
System.out.println("I ame tree");
}
}


class appleTree extends Tree
{
public void myName()
{
System.out.println("I am apple tree");
}
}

class pearTree extends Tree
{
public void myName()
{
System.out.println("I am pear tree");
}
}


class program
{
public static void main(String [ ] args)
{
Tree a = new appleTree();
Tree p = new pearTree();
a.myName();
p.myName();
}
}



Dodaj komentarz






Dodaj

© 2013-2024 PRV.pl
Strona została stworzona kreatorem stron w serwisie PRV.pl