When is really useful to use a nested Java class?

后端 未结 4 982
猫巷女王i
猫巷女王i 2021-01-25 03:52

Could you give me a concrete example where a nested java class is useful? I am studying it, I understand how it works but I can not imagine a real situation where its use is rea

4条回答
  •  清酒与你
    2021-01-25 04:26

    It's used (also) to implement the Builder Pattern

    First of all you need to create a static nested class and then copy all the arguments from the outer class to the Builder class

提交回复
热议问题