Below code is some example analogous to what I am trying to achieve. I have to store the data from internal class but the compiler complains following:
returnedValue=(MyXYZClass)value.toString();
Local variable selectedBusinessArea defined in an enclosing scope must be final or effectively final
private String methodInMainClass(Object someRef){
String returnedValue="";
new SomeInnerClass(Object someRef){
@Override
public String getData(Object value){
if(value instanceof MyXYZClass){
returnedValue=(MyXYZClass)value.toString(); // Not Happening. I cannot assign it to the outer variable.
}
return super.getData(value);
}
}
How can I store the value from the overriden method in internal class?