+ 2

What is the difference "static int" and simple "int"?

static int X = 10; ï»ż int B=3;

9th Nov 2017, 11:40 PM
LOGANATHAN SULAKSHAN
LOGANATHAN SULAKSHAN - avatar
2 Answers
+ 5
IN WHAT LANGUAGE?
10th Nov 2017, 1:18 AM
Asiri H
Asiri H - avatar
+ 6
You didn't specify a language, but generally speaking when you declare a variable as static it will belong to the class itself and not just an instance of the class. X in this case would have the same value for all instances of the class it is within.
10th Nov 2017, 12:29 AM
ChaoticDawg
ChaoticDawg - avatar