I have a local class...
public class Outer {
public void wrapper() {
class Local {
}
}
}
and I have a test that needs to reference the local class...
Outer.wrapper.Local.class ## this doesn't seem to work
How can I reference the local class?
You can only reference a Local Inner class inside the method in which you have declared it:
public void wrapper() {
class Local {
}
Local obj = new Local();
}
This classes tend to not be very useful due to their limited scope. If you have found a valid use case to define one take a look at this tutorial.