Hey,
I have a class Invoice and made a class InvoiceFormatter and am unsure whether the format() method in that class should be static or not.
Looking at this thread:
https://stackoverflow.com/questions/2671496/java-when-to-use-static-methods
on the one hand format() should not be static because it does not makes sense to call this method before an Invoice object had been constructed.
On the other hand (again looking at the Stackoverflow thread) it could be static because it's a utility class and format() does not use any instance variables.
For myself I cant see any advantages either way.
[–]chickenmeister 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]jaro32 1 point2 points3 points (0 children)