What does the syntax mean in Java: new Stream(){ … }?

后端 未结 3 649
夕颜
夕颜 2021-01-20 23:30

I have encountered the following Java syntax that I don\'t recognize.

This part is fine:

public abstract class Stream implements Iterator

        
3条回答
  •  无人及你
    2021-01-21 00:15

    This is defining a Anonymous class which implements the Stream interface. To implement the interface we need to implement the method next.

提交回复
热议问题