public class SomeClass {
//Some code
private static InnerClass {
String test;
private InnerClass(String test) {
this.test = test;
}
// Using test here in some way
test.split("something"); //Compiler error, test might not have been initialized
}
Why does the compiler complain about that? I am initializing test
in the constructor. If the compiler is complaining, that means there might be a way to access test
without going through the constructor. I tried that, but no luck without reflection. What am I missing here?