Is it mandatory utility class should be final and private constructor?

后端 未结 4 551
逝去的感伤
逝去的感伤 2021-02-02 00:55

By making private constructor, we can avoid instantiating class from anywhere outside. and by making class final, no other class can extend it. Why is it necessary for Util clas

4条回答
  •  不思量自难忘°
    2021-02-02 01:31

    By default this kind of class normally is used to aggregate functions who do different this, in that case we didn't need to create a new object

提交回复
热议问题