Java final abstract class

后端 未结 9 2051
情歌与酒
情歌与酒 2021-02-02 06:26

I have a quite simple question:

I want to have a Java Class, which provides one public static method, which does something. This is just for encapsulating purposes (to h

9条回答
  •  Happy的楠姐
    2021-02-02 07:14

    Declare the constructor of the class to be private. That ensure noninstantiability and prevents subclassing.

提交回复
热议问题