Is it possible to have an anonymous inner class return a value for a method it is contained in? For example, I want to do some calculations in something()
, which is an anonymous inner class, and have doStuff()
return that value.
private int doStuff(){
Foo foo = new Foo(new Bar.Example() {
@Override
public void something() {
...
//return int for doStuff()
}
});
}