다음 두 가지 예가 Android 애플리케이션에서 사용되는 경우 차이점은 무엇입니까? 초기화 값이 사용 가능하고 초기화 할 때정적 변수를 초기화하는 두 가지 방법의 차이점은 무엇입니까?
가public static int x = 9;
이 잘 작동 다음 Oracle tutorial 당 같이
예 1
public class ExampleClassOne {
public static int x = 9;
}
예 -2-
public class ExampleClassTwo{
public static int x;
static{
x = 9;
}
}
심지어'public static final'은 정적 블록에서 초기화 될 수 있습니다 – sanbhat