Please explain the use of static key word in java?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please explain the use of static key word in java??

27th Apr 2019, 6:41 PM
Soumya Halder
Soumya Halder - avatar
2 Answers
+ 2
Static keyword is useful when you want to declare certain variables before creating an instance of a class. So static variables belong to a class instead of a specific instance of a class. Same thing goes with static methods. For more information: https://stackoverflow.com/questions/449445/java-static
27th Apr 2019, 8:20 PM
Juho Pesonen
Juho Pesonen - avatar
27th Apr 2019, 8:41 PM
Denise Roßberg
Denise Roßberg - avatar