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. abstract static class Foo {
  11. protected int x;
  12. protected Foo(int x) {this.x = x;}
  13. public abstract void bar();
  14. }
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17. Foo foo = new Foo(123) {
  18. public void bar() {System.out.println("hi "+x);}
  19. };
  20. foo.bar();
  21. }
  22. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
hi 123