Sometimes I confuse properties with variables. How to avoid it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sometimes I confuse properties with variables. How to avoid it?

14th Sep 2016, 11:05 AM
Mykola Mysko
Mykola Mysko - avatar
1 Answer
+ 1
A Property will use one or more variable to define it. Ex: In the Person class, they have a Property of HairColor. HairColor is defined as a String variable type that can accept a value. Since HairColor can be set to "blonde" or "black" or "brown", etc. It is in effect a variable. But in terms of a class it is called a property. So, thinking of a property like a variable is a good start.
23rd Sep 2016, 4:05 PM
Roy Hughes