0

How to i know when use static method and when non static? Pleas check my code it dont work without static method. Why?

Probleme static method vs public https://code.sololearn.com/cW4dyRQ8xRBi/?ref=app

2nd Oct 2017, 5:34 PM
Samo Adamec
Samo Adamec - avatar
2 Réponses
+ 10
Main method gets called by the JVM without creating an object. And if you don't have an object, you can only call the method static. You could instantiated a class and call the method there without using static.
2nd Oct 2017, 5:36 PM
Tashi N
Tashi N - avatar
+ 1
thank you for reply
2nd Oct 2017, 6:33 PM
Samo Adamec
Samo Adamec - avatar