-1
In a certification review, I came across the following code:
public class Initializer {
static int si = 10;
int i;
final boolean bool;
}
It generates build error in variable declaration final boolean bool
, because this one hasn’t been initialized.
Note that the variable int i
also not initialized, but there is no problem, because the instance variables (not final?) are initialized implicitly.
But then, why is there this differentiation with final
and it is mandatory to initialize a final variable when an instance is built?
I think that that answer from Luiz or the one with the mustache already answer your question.
– Renan Gomes