abstract class Animal{
public abstract void talk();
}
class Cat extends Animal{
public void talk(){
System.out.println("miawww,miawwww");
}
}
class Dog extends Animal{
public void talk(){
System.out.println("woof,woof");
}
}
class Mysoft{
public static void getVoice(Animal a)
{
a.talk();
}
}
class Main{
public static void main(String[] args) {
Cat c= new Cat();
Dog d=new Dog();
Mysoft.getVoice(c);
}
}
public abstract void talk();
}
class Cat extends Animal{
public void talk(){
System.out.println("miawww,miawwww");
}
}
class Dog extends Animal{
public void talk(){
System.out.println("woof,woof");
}
}
class Mysoft{
public static void getVoice(Animal a)
{
a.talk();
}
}
class Main{
public static void main(String[] args) {
Cat c= new Cat();
Dog d=new Dog();
Mysoft.getVoice(c);
}
}
Java today is one of the most popular digital applications in web designing & is being preferred by the layman as well as high end users for different purposes such as in flash video application, 3-D gaming, complex software development etc....
ReplyDeletejava
Hi Rosen Rose,
ReplyDeleteWhat your saying is exactly right. I agree with you.
Java for Teens