fork(10) download
  1. object Main extends App {
  2. def foo[T](code: => T) : Runnable = new Runnable { def run = code }
  3. override def main(args: Array[String]): Unit = {
  4. val x: Runnable = foo(() => {
  5. System.out.println("b")
  6. })
  7. val y: Runnable = foo({
  8. System.out.println("d")
  9. })
  10. System.out.println("a")
  11. x.run()
  12. System.out.println("c")
  13. y.run()
  14. System.out.println("e")
  15. }
  16. }
  17.  
Success #stdin #stdout 0.25s 322240KB
stdin
Standard input is empty
stdout
a
c
d
e