Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write a Java Program TO Explain The Concept of Various Inheritance
- //1. Single Inheritance
- class Animal
- {
- void eat()
- {
- System.out.println("Eating");
- }
- }
- class Dog extends Animal
- {
- void bark()
- {
- System.out.println("Barking");
- }
- }
- class Ex13 // Ex13 is FileName
- {
- public static void main(String args[])
- {
- Dog d = new Dog();
- d.bark();
- d.eat();
- }
- }
Add Comment
Please, Sign In to add comment