local classes - Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

local classes - Java

Is it possible to create local static classes in Java? I mean classes inside methods with the static annotation. It would be awesome if you could explain to me why it is possible or why not.

2nd Feb 2022, 11:14 AM
TOBI.ON
TOBI.ON - avatar
1 Answer
+ 2
No. Because it's declared inside a method then it's scope is limited to method only... So it don't have any access modifiers of public, private, protected, and also static.
2nd Feb 2022, 3:52 PM
Jayakrishna 🇮🇳