Can we consider the variables as objects of a class? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we consider the variables as objects of a class?

Can we consider the variables as objects of a class? If not, what is the difference between the two(variable and objet)?

9th Mar 2017, 7:28 PM
arp diallo
arp diallo - avatar
2 Answers
+ 7
A variable is a named value. A variable can have a primitive value (int, boolean, ...) or an Object reference (a reference to an Object). Or it can be null if it doesn't refer to an object. (Is "refer" a valid verb?)
9th Mar 2017, 7:55 PM
Tamás Barta
Tamás Barta - avatar
+ 1
In most languages they are objects of a class. In particular, in Java, strings are objects, that's why they are called Strings with bis S. And by variables, I think you mean data types.
9th Mar 2017, 7:46 PM
spotbot2k
spotbot2k - avatar