0
the static keyword can be used on a variable or a function and they declared/initialized once but you can access it multiple times ( this is how in c++, I believe same in Java ). while(true){ static int x = 5; // declare variable once // won't declare it over and over again in the loop x++; // adding 1 to x } outputs: 5 6 7 8 9 10 and goes on.
15th Nov 2017, 3:51 PM
Cain Eviatar
Cain Eviatar - avatar