Sometimes we call className.methodName()
without creating object for it, I mean without using syntax as className objectName = new constructor()
and then call as object.methodName()
- When to use
className.methodName()
? - When to call method using object as
object.methodName()
?
Explanation of above two cases with example will be appreciated.