BlackBoY_

yg interface

Jun 30th, 2021 (edited)
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package ContohAbstractInterface;
  2.  
  3. interface PowerRangers{
  4.     public void henshin();
  5.     public void fusion();
  6. }
  7.  
  8. interface Pertarungan{
  9.     public void menang();
  10.     public void kalah();
  11. }
  12.  
  13. class rangers implements PowerRangers, Pertarungan{
  14.  
  15.     @Override
  16.     public void henshin() {
  17.         System.out.println("Berubah Menjadi Power Rangers");
  18.     }
  19.  
  20.     @Override
  21.     public void fusion() {
  22.         System.out.println("Bergabung Menjadi Robot Gorila");
  23.     }
  24.  
  25.     @Override
  26.     public void menang() {
  27.         System.out.println("Rangers Menang");
  28.     }
  29.  
  30.     @Override
  31.     public void kalah() {
  32.         System.out.println("Rangers Kalah");
  33.     }
  34.    
  35. }
  36.  
  37. class InterfaceAnjay {
  38.     public static void main(String[] args) {
  39.         rangers red = new rangers();
  40.         red.henshin();red.fusion();red.kalah();
  41.     }
  42. }
Add Comment
Please, Sign In to add comment