Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package pkgabstract;
- /**
- *
- * @author Student
- */
- abstract class Animal {
- abstract void sound();
- }
- class Dog extends Animal {
- @Override
- public void sound() {
- System.out.println("Ghug Ghug");
- }
- }
- class Cat extends Animal {
- @Override
- public void sound() {
- System.out.println("Meow ");
- }
- }
- public class Abstract {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Dog d1 = new Dog();
- d1.sound();
- Cat c1 = new Cat();
- c1.sound();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement