Can we use it like this? Why or why not? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
16th Nov 2019, 4:28 AM
palak pandey
palak pandey - avatar
2 Answers
+ 3
You cannot keep a top level class as static in Java but you can keep a class static if it is inside another class. This is useful because then you don't have to create an instance of the top level class to access the methods of the inner class.
16th Nov 2019, 4:51 AM
Avinesh
Avinesh - avatar
+ 1
Well we can declare classes static.
16th Nov 2019, 4:49 AM
palak pandey
palak pandey - avatar