compiler construction - Initializing final fields - Java -


I would like to know if there is a compiler option that can allow me to remove / treat the error (" Variable x could not be started ") when I compile the range in which it has the last field or better than that the last field will start to start the last Java scheme.

Thanks,

ExtremeCoder

to treat the error The way to fix the code is: Make sure you start the value explicitly, I believe there is no alternative to ignoring the error.

One way to mimic this is to allow constructor local variables to be set to Java default values, then replace them during the constructor. At the end of the constructor, set the field value of the local variable.

Note, if you get a lot of code in your constructor, you may still want to consider refactoring ...


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -