0

Why are variables used in java

17th Mar 2017, 10:41 AM
Ch. Sabitha
Ch. Sabitha - avatar
2 Answers
+ 4
To store values according to the type of the values, for example, double or float: 2.45(number with decimal place), integer: 2(number without decimal place), boolean: true or false, character: a, b, , c,..., String: “Hello World!”
17th Mar 2017, 10:55 AM
Heng Jun Xi
Heng Jun Xi - avatar
+ 3
variables also help to make the code easier to read. for example when you want to do something with the return value of several functions it's better to store them in variables than to write everything in one long line.
17th Mar 2017, 4:14 PM
Mario L.
Mario L. - avatar