I'm checking if the variable is initialized but at that point netbeans is giving me variable reader might not have been initialized
warning. How do I fix/suppress this?
This is my code (summary):
final Reader reader;
try {
reader = new Reader(directory);
//additional stuff that can cause an exception
} catch (Exception ex) {
//do stuff
} finally {
if (reader != null);
}
The point of the if check is to determine whether it is initialized.
And what is the best practice for this?