posted 7 years ago
Please see below 3 points. Why compiler allowed point 2 and not point 1?
Point 2 leads to NPE in point 3,
Why does the compiler allowed point 2 in the first place?
I expected the compiler to give a compilation error as in point 1.
1.
Compilation error: As I expected:
Multiple markers at this line
- Cannot reference a field before it is
defined
- Cannot reference a field before it is
defined
2. But then I solved the compilation error by using FtNpeInterface.doubleFT
3. But then at rumtime, Caused by: java.lang.NullPointerException
At first, I did not see why.
But tracing down from sequential timing point of view, I see why NullPointerException occured.