Java: startingPath as “public static final” exception

后端 未结 5 1104
天涯浪人
天涯浪人 2021-01-26 13:00

[Updated, sorry about the change but now to the real problem] I cannot include try-catch-loop there for the exception from the method getCanonicalPath(). I trie

5条回答
  •  日久生厌
    2021-01-26 13:31

    Just initialize it in the static block(the variable is final). You can't catch exceptions on declaring a variable.

提交回复
热议问题