Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    I'm not sure if this is really creating an "instance" of the interface. Your really creating an inline implementation. Commented Jun 30, 2016 at 5:49
  • Having interface default constructor would avoid hypothetical code like MyFace obj = new MyFace(){}; obj.init();´, so a bit more than just ´{}´, especially if calling init would be mandatory for implementation. Commented Jun 30, 2016 at 11:40
  • @hyde: that’s a nonsensical scenario, as there is nothing useful which init() can do. The object created via new MyFace(){} doesn’t contain any state that an init() method could modify. Commented Jun 30, 2016 at 15:01