Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package Testing;
  7.  
  8. /**
  9.  *
  10.  * @author HP
  11.  */
  12. class House {
  13.     public void color(){
  14.         System.out.println("Ini pintu rumah saya");
  15.     }
  16. }
  17. class Window extends House{
  18.     @Override
  19.     public void color(){
  20.         System.out.println("Jendela berwarna putih");
  21.     }
  22.     public void panjang(){
  23.             System.out.println("Panjangnya 15 meter");
  24.     }
  25. }
  26. public class MyHouse{
  27.     public static void main(String[] args) {
  28.         House a = new House();
  29.         House b = new Window();
  30.        
  31.         a.color();
  32.         b.color();
  33.         b.panjang();
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement