Advertisement
Faria_Afrin

2 Interface

Apr 6th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public interface Info1 {
  2. public void method1();
  3.  
  4.  
  5. }
  6.  
  7. public interface Info2 extends Info1 {
  8. public void method2();
  9. }
  10. public class Demo implements Info2{
  11. public void method1() {
  12. System.out.println("method1");
  13.  
  14. }
  15. public void method2() {
  16. System.out.println("method2");
  17.  
  18. }
  19. }
  20.  
  21. public class Main {
  22.  
  23. public static void main(String[] args) {
  24.  
  25. Info2 obj = new Demo();
  26. obj.method2();
  27. obj.method1();
  28.  
  29. Info1 obj1 = new Demo();
  30. obj1.method1();
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement