I came across this piece of code while I was working on a project, this was reported as a bug for something.
public class Test {
public static Test ONE = new Test() {
@Override
public int value() {
return 1;
}
};
private Test() {
}
public int value() {
return 0;
}
}
What I think this code means:
I think that this is simply instantiating the class Test with a reference variable named ONE.
What the user mentioned:
The user mentioned that this is a nested class within the outer class, but I'm confused that how can a class be nested within itself.
What I have researched:
I used code parser named ANTLR to parse this code and it showed that this is not a class, insted used the token Type.
Thanks in Advance
