+ 1
I get an ERROR (whatever my var is ) cannot be resolved to a variable
Error
8 Respuestas
0
Maybe, it is about the scope of variable.
0
Meaning?
0
Mine involves arrays
both of the example ones said that error
0
Could you copy and paste your code for us please?
0
if(1==0) {
String myVar = "a";
System.out.println(myVar);
}
0
i think its ur if condition which is suspicious !! try ( 1!=0)
0
your if condition is false, so next line is not executed. That's why myVar remains not declared. either correct your if condition or put a semicolon after it.
- 1
E.g.
if(1==0)
String myVar = "a";
System.out.println(myVar);
Error myVar cannot be resolved.