Static local variable throws compile time error??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Static local variable throws compile time error???

Static void m() { Static int x=5; } y error?

14th May 2017, 6:32 AM
keshu
keshu - avatar
4 Answers
+ 3
You can't declare static variable in a method in Java as you can do in C++
14th May 2017, 6:34 AM
Tamás Barta
Tamás Barta - avatar
+ 2
In Java things are not implemented if they are not really needed and can be solved in other way to keep language simple.
14th May 2017, 6:36 AM
Tamás Barta
Tamás Barta - avatar
0
Reason??
14th May 2017, 6:35 AM
keshu
keshu - avatar
0
Reason??
14th May 2017, 6:35 AM
keshu
keshu - avatar