Can somebody explain the usefulness of public static in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can somebody explain the usefulness of public static in java?

meaning of public static

30th Jul 2018, 5:31 PM
omomehin
1 Answer
0
What context do you mean? If you are about the start method, the Java developers preferred to call it static, rather than creating the object of your main class. Yes, they could call the constructor of your class, but what happens if someone else creates an object of your class? Private constructor will only make things worse P.S. In java, all functions must be tied to classes (java is fully oop)
30th Jul 2018, 5:39 PM
Mishin870
Mishin870 - avatar