Guest User

Untitled

a guest
Jun 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. interface InterfaceA{
  2. void functionA();
  3. }
  4.  
  5. interface InterfaceB{
  6. void functionB();
  7. }
  8.  
  9. class A implements InterfaceA{
  10. @override
  11. void functionA(){
  12. System.out.println("classA: functionA");
  13. }
  14. }
  15.  
  16. class B implements InterfaceB{
  17. @override
  18. void functionB(){
  19. System.out.println("classB: functionB");
  20. }
  21. }
  22.  
  23. class Test implements InterfaceA, InterfaceB {
  24.  
  25. InterfaceA instanceA;
  26. InterfaceB instanceB;
  27.  
  28. Test(InterfaceA interfaceA, InterfaceB interfaceB){
  29. instanceA = interfaceA;
  30. instanceB = interfaceB;
  31. }
  32.  
  33. @override
  34. void functionA(){
  35. instanceA.functionA();
  36. }
  37.  
  38. @override
  39. void functionB(){
  40. instanceB.functionB();
  41. }
  42.  
  43. }
Add Comment
Please, Sign In to add comment