0
What Is variable
2 Antworten
+ 1
a variable is a piece of code that allocates memory. e.g. mycar = "kia" Now the memory is allocated so mycar will return "kia". Its called a variable because the value can be reallocated/changed. Except if you declare it as constant or final.
+ 1
a variable is a reference to a value, like if you set a variable to hold a value, 1. then x stands for 1 unless x is changed while runtime
int x = 1
the above code initializes a variable a of integer and assigns the value one to it. It means that x means 1