Advertisement
Guest User

Untitled

a guest
May 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. interface ABC {
  2. public void callme();    
  3. }
  4.  
  5. abstract class A implements ABC {
  6. abstract public void callme();
  7.  
  8.  
  9.  
  10. void callmetoo() {
  11. System.out.println("This is a concrete method.");
  12. }
  13. }
  14.  
  15. class B extends A {
  16. public void callme() {
  17. System.out.println("B's implementation of callme.");
  18. }
  19. }
  20.  
  21. class AbstractDemo {
  22. public static void main(String args[]) {
  23. B b = new B();
  24. b.callme();
  25. b.callmetoo();
  26. }
  27. }
  28.  
  29. //OUTPUT:
  30. //B's implementation of callme.
  31. //This is a concrete method.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement