Can anyone explain why a static member class cannot implement an interface, unless the interfac开发者_运维问答e is a marker?
It can. For example, this compiles with no problems:
interface Foo {
void foo();
}
class Outer {
static class Inner implements Foo {
public void foo() {
}
}
}
I'm assuming Inner
is what you mean by a "static member class" here? If not, please edit the question to provide an example.
Inner classes can implement any interface.
this link will clarifies your any doubt about inner class
http://www.oopweb.com/Java/Documents/ThinkingInJava/Volume/TIJ310.htm
精彩评论