fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12.  
  13. Outer o = new Outer();
  14. Outer.Inner inner = o.create();
  15. inner.operate();
  16. }
  17. }
  18.  
  19. class Outer {
  20.  
  21. public final class Inner {
  22.  
  23. private final Outer outer;
  24.  
  25. private Inner(Outer outer) {
  26. this.outer = outer;
  27. }
  28.  
  29.  
  30. public void operate(){
  31. outer.operateOn(this);
  32. }
  33. }
  34.  
  35. Inner create() {
  36. return new Inner(this);
  37. }
  38.  
  39. private void operateOn(Inner inner) {
  40. System.out.println(inner);
  41. }
  42. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
Outer$Inner@e51960