Best way to group common functons in java

Could anybody suggest me a best way to group all common function's in a java project ?
manugeekAsked:
Who is Participating?
 
a_bConnect With a Mentor Commented:
Does the class containing these methods have any state?

If not, then create a singleton test utility class and write those methods.
If yes, then you need to follow the OOPs concepts.
0
 
a_bCommented:
Depends on what you mean by common functions.

If they are helper functions you can group them in a singleton utility class.

Else as per the object oriented programming guidelines you add associated functions to an object.
0
 
Gurvinder Pal SinghCommented:
besides what @a_b has mentioned, if the methods are too similar, you can also refactor and combine then into one. If the difference is minor only, an if condition can be added for the same
0
 
Hugh McCurdyCommented:
Perhaps some context would help.  Do you have some methods (functions) in mind?
0
 
manugeekAuthor Commented:
I am writing a testng program and would like to use the following methods fetch(), validate(), createReport() across my testng functions
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.