0

Hi

can someone explain to me why is NOT used and is array.size same as array.length

12th Sep 2016, 3:30 PM
Ljubisa
1 Odpowiedź
0
not (I assume you are talking about negation, '!') is used to form a functionally complete set of logical operators. This means that any logical proposition can be evaluated from its propositional variables and operators. For example, if P is true when a dog is black and female then "dog.color == Color.Black && dog.gender == Gender.female" then this works fine without a negation. However if, for example, you want to check that it's not the dogs birthday then you'd have to do something like this, which uses negation: "dog.birthday != Day.today". arrays do not have a size, only a length. The length of an array is constant and is the maximum capacity of that array. You can create an array of size 10, and only fill array[0] with a value, and the length will still be 10. ArrayList however does have a size method and this returns the number of elements in the list.
12th Sep 2016, 10:19 PM
Greg Sims
Greg Sims - avatar