+ 5
"static" means the same regardless of data type. It means the array isn't attached to an instance of a class. In other words, the life of the variable is basically the life of the running program instead of a new copy being made with each and every instance of a class. c++ and c lets you do something Java doesn't. c++ and c lets you declare static variables within functions. The meaning is slightly different from above but very similar. It means that despite the variable being declared within the function, its state will continue as long as the program runs. In other words, a locally declared static variable is like a global variable except it is accessible only within the scope of that function. You may be interested in "static" for Java: https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
6th Apr 2021, 5:04 AM
Josh Greig
Josh Greig - avatar