A programming like this,
static {
a = 6;
}
Why the element "a" does not need a type?
A programming like this,
static {
a = 6;
}
Why the element "a" does not need a type?
This is not a declaration of a variable, this is the assignment of a variable. The type of 'a' is defined somewhere else. So, this code itself won't compile, you'll need a variable declaration like:
class X {
private static int a;
static {
a = 6;
}
}
As an answer to the comment below, this is the initializion sequence:
I think somewhere you initialized the variable a
private static int a;
static {
a = 6;
}