Naming convention for utility classes in Java

前端 未结 5 1737
离开以前
离开以前 2021-01-29 21:53

When writing utility classes in Java, what are some good guidelines to follow?

Should packges be \"util\" or \"utils\"? Is it ClassUtil or ClassUtils? When is a class a

5条回答
  •  滥情空心
    2021-01-29 22:15

    I think that 'utils' should be the package name. The class names should specify the purpose of the logic inside it. Adding the sufix -util(s) is redundant.

提交回复
热议问题