Java: Interface with new keyword how is that possible?

前端 未结 9 1513
抹茶落季
抹茶落季 2020-12-04 08:21

I was reading some sourcecode from Java libraries, and I am confused here;

This code is from Document.java in jaxb library, and ContentVisitor is an Interfac

9条回答
  •  暖寄归人
    2020-12-04 09:02

    You actually have just provided the implementation of this interface in an anonymous way. This is quite common and of course possible. Have a look here for more information.

提交回复
热议问题