What are static and void???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are static and void????

Please explain static and void of JAVA.

29th Jun 2021, 10:22 AM
Parth
Parth - avatar
2 Answers
+ 1
The public keyword means that the method is accessible to any class. The static keyword means that we don't need to create an instance (copy) of the object in memory. The void keyword means that the method does not return any data. https://stackoverflow.com/questions/2390063/what-does-public-static-void-mean-in-java#:~:text=static%20means%20that%20the%20method,write%20int%20instead%20of%20void%20. 
29th Jun 2021, 10:25 AM
SammE
SammE - avatar
+ 1
however class with static field, can be instantiated many times, but static field is one comon for all this objects.
29th Jun 2021, 7:51 PM
zemiak