+ 1
Is it necessary that a method has to create an instance of a class in order to be used ?
4 ответов
+ 12
Hi,
maybe I misunderstand your question, but static methods don't need to have a concrete instance in order to be used. Prominent example is the Math methods. You don't need to create an instance of the Math object, instead you simly use them by refering directly to the class: Math.abs(), you name it...
+ 11
no , you have static methods. 🐈
+ 4
The Class is like a blueprint
through the constructor an object of that class is created (instance of the class)
the object may have methods that define its behavior.
Once the object is created you can call those methods in your program.
+ 3
you can just use static method
and you call it by class.method instead of object.method