[Solved] why do we declare a method as static [closed]


Adding onto what everybody else said. A normal class method you would have to instantiate the object as follows.

If you have a class called ClassExample with a method testMethod
You would have to do the following to call it

ClassExample example = new ClassExample();
example.testMethod()...

if you have a static method you do not have to worry about instantiating the object so you can do something similar to the following

 ClassExample.testMethod()

3

solved why do we declare a method as static [closed]