aquaballoon

Java - Inner Class

Mar 12th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. // Init.java
  2. package jason;
  3.  
  4. public class Init {
  5.  
  6.     public static void main(String[] args) {
  7.  
  8.         new Son.Sson().action();  //action
  9.        
  10.         new Son.Sson(){
  11.             void action(){
  12.                 System.out.println("main - action");
  13.             }
  14.         }.action();             //main - action
  15.     }
  16.  
  17. }
  18.  
  19.  
  20. // Son.java
  21. package jason;
  22.  
  23. public class Son {
  24.        
  25.         static class Sson{
  26.             void action(){
  27.                 System.out.println("action");
  28.             }
  29.         }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment