fork download
  1. class Example
  2. {
  3. public static void main (String[] args)
  4. {
  5. MyClass c = new MyClass();
  6. Runnable r = c::myMethod;
  7. r.run();
  8. }
  9. }
  10. class MyClass{
  11. public void myMethod(){
  12. System.out.println("myMethod was called");
  13. }
  14. }
Success #stdin #stdout 0.12s 4386816KB
stdin
Standard input is empty
stdout
myMethod was called