ricerca di questo codice:variabile potrebbe essere già stata assegnata quando non può essere assegnato
public class TestFinalAndCatch {
private final int i;
TestFinalAndCatch(String[] args) {
try {
i = method1();
} catch (IOException ex) {
i = 0; // error: variable i might already have been assigned
}
}
static int method1() throws IOException {
return 1;
}
}
compilatore dice che java: variable i might already have been assigned
Ma per me è assomiglia situazione impossibile.
Questo è davvero un buona risposta alla stessa domanda: http://stackoverflow.com/a/17075219/1354590 – kuporific
E la soluzione è già presentata qui http://stackoverflow.com/a/13604193/1354590 – kuporific