About static method in java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

About static method in java

What is the best scenario when using a static method in java since it changes all the value that you just instantiated with that class? Thank you...

15th Nov 2021, 5:47 AM
Kakai
Kakai - avatar
1 Answer
0
If you don't want to add any class except main class and you don't want an object, you are not using any oops concepts but you want to add some method in the main class, then static method is used. This is one scenario for beginners. Another cases includes when you want something to have only one value at a time and you don't want to waste memory then static method can be used. There are so many uses....
15th Nov 2021, 6:35 AM
Arun Ruban SJ
Arun Ruban SJ - avatar