The Difference Between Instance & Static Methods in Java

245
0
SHARE

An instance method is a method used only for THAT VERY INSTANCE. A static method is FOR EVERY INSTANCE.

Here’s a little code snippet to make your life easier. As usual.

In the case above. If you set the name in a static way.. all the persons are called John Doe. If you make an instance¬†and use an instance method, then you only set that Object’s name. To “God” in this case.

Until next time, Josh.

Related:  How to Create & Manipulate Java Priority Queues