This is just a short example of Go code:
package main import "fmt" func main() { defer fmt.Println("world") //use of keyword 'defer' fmt.Println("hello") }
I find the equivalent of 'defer' in Java.
Instead of defer, I can use
try { //do something } finally { //code using defer }
Is there an alternative without using try / catch / finally?
source share