If a class does not have any state (that is, it consists of only methods), what is best design approch to follow? 1. Make the methods static. So that users can directly access the methods which out any objects 2. Still make it as instance methods, user should make an object and invoke the methods Pl refer any document/url regd this design guidelines. thank you very much
Depends. Static methods aren't polymorphic - they are resolved at compile time by the type of the reference (instead of the type of the referenced object). Therefore, if you want to use polymorphism, you need to use instance methods - the Strategy design pattern is a good example. OTOH, if the class provides simple helper methods (like java.lang.Math does), it's probably ok to make the methods static. Does that help?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus