What does Static {} mean in the Java Syntax?

后端 未结 7 1264
野趣味
野趣味 2020-12-13 13:49

I came across this Java code:

static {
    String aux = \"value\";
    try {
        // some code here
    } catch (Exception e) { }
    String UUID_prefix =         


        
7条回答
  •  旧时难觅i
    2020-12-13 13:58

    This syntax has been outdated as of Java 7. Now the equivalent is:

    public static void main(String[] args) {
        /*
          stuff
        */
    }
    

提交回复
热议问题