Users Pricing

forum

home / developersection / forums / java: where to use static methods

Java: where to use static methods

Allen Scott 1991 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?


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

Obj.someMethod
(is this the static way?)

I'm rather confused

Allen Scott

Other


1 Answers