fork(5) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. abstract class Sian //ABSTRACT CLASS
  9. {
  10. public final void show() // FINAL METHOD
  11. {
  12. System.out.println("Yes");
  13. }
  14. public void display()
  15. {
  16. System.out.println("Overriding");
  17. }
  18. public abstract void success();
  19. }
  20. class Ideone extends Sian //INHERTING ABSTRACT CLASS
  21. {
  22. public void display()
  23. {
  24. System.out.println("Overridden");
  25. }
  26. public void success() //OVERRIDING THE ABSTRACT METHOD
  27. {
  28. System.out.println("Success overriding");
  29. }
  30. public static void main (String[] args) throws java.lang.Exception
  31. {
  32. Ideone id = new Ideone(); //OBJECT OF SUBCLASS
  33. id.show(); //CALLING FINAL METHOD
  34. id.display(); //OVERRIDDEN METHODS
  35. id.success();
  36. }
  37. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
Yes
Overridden
Success overriding