我读这样的:A closure looks a lot like a regular Java or Groovy code block, but actually it's not the same. The code within a regular code block (whether its a method block, static block, synchronized block, or just a block of code) is executed by the virtual machine as soon as it's encountered. With closures the statements within the curly brackets are not executed until the call() is made on the closure. In the previous example the closure is declared in line, but it's not executed at that time. It will only execute if the call() is explicitly made on the closure
有关Groovy关闭的声明说明。
而且我想,这是怎么真实,在Java中,如果你有一个实例方法,当调用该方法,然后他们是如何说上面只执行的代码虚拟机一看到它就执行它? 如果我有一个方法func(){int a =5; return a+5;}
,只有当我的理解被调用时才会执行此操作。