forum

Home / DeveloperSection / Forums / Java: where to use static methods

Java: where to use static methods

Allen Scott 1674 04-Sep-2015
I am wondering when to use static methods? Say If i have a class with a few getters and setters, a method or two, and i want those methods only to be invokable on an instance object of the class. Does this mean i should use a static method?

e.g

Obj x = new Obj();
x.someMethod
or

Obj.someMethod
(is this the static way?)

I'm rather confused

Updated on 04-Sep-2015

Can you answer this question?


Answer

1 Answers

Liked By