Advertisement
sidhartha11

Untitled

Mar 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public interface InterfaceExampleV8 {
  2.  
  3. public static String STATICVARIABLE = "A static variable";
  4. default void aDefaultMethod(String name) {
  5. Utility.p("This is a default method in an interface:" + name);
  6. }
  7.  
  8. static void aStaticMethod(String name) {
  9. Utility.p("This is a static method in an interface:" + name);
  10. }
  11.  
  12. public void anAbstractMethod(String name);
  13.  
  14. public static void main(String[] args) {
  15. System.out.println("calling a main method in an Interface!");
  16. aStaticMethod("what!!!");
  17. InterfaceExampleV8 v8 = new InterfaceExampleV8(){
  18.  
  19. @Override
  20. public void anAbstractMethod(String name) {
  21. System.out.println("calling the abstract method inside the interface:" + name);
  22. aDefaultMethod("Now This cannot Be!:" + name);
  23. }
  24.  
  25. };
  26. System.out.println("calling interface methods");
  27. v8.aDefaultMethod("Help!!!");
  28. v8.anAbstractMethod("Help even more!!");
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement