I want to check if a certain element in an array has been initilized, how can I do this?
All values in an array are initialised when the array is created.
Initial values may be set explicitly (e.g. X[] xs = {x1, ..., xN};
), or default values will be assigned when the array is instantiated.
For an array of objects, the default value of each element will be null
; for a boolean
array, the value will be false
; for an array of byte
, char
, int
, long
the value will be 0
and for an array of float
or double
the value will be 0.0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With