Advertisement
wzul

Contoh Java Inner Class

Jan 9th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. public class Rumah {
  2.  
  3.     private class Bilik {
  4.         public int katil = 3;
  5.     }
  6.     public static void main(String[] args) {
  7.         Rumah a = new Rumah();
  8.         a.tengokBilik();
  9.     }
  10.    
  11.     public Rumah tengokBilik(){
  12.         Bilik wan = new Bilik();
  13.         System.out.println(wan.katil); // Output 3
  14.         return this;
  15.     }
  16.    
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement