The statement s = "New Value";
is not within a method. It's anonymous class, but it's still a class. The problem is equivalent to
public class SomeSubClass {
String s = "Value";
s = "New Value";
}
The problem should be more apparent now.
Place the statement in a method or constructor, or initialize s
to "New Value"
instead of "Value"
.