0

What Is variable

1st Feb 2017, 3:29 PM
Rupesh
Rupesh - avatar
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.
1st Feb 2017, 3:45 PM
Andre van Rensburg
Andre van Rensburg - avatar
+ 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
1st Feb 2017, 4:17 PM
Thomas Sudeep Benardo