Are Java arrays categorized as primitive types or reference
Are Java arrays categorized as primitive types or reference types?
A. primitive types
B. reference types
| A. primitive types | ||
| B. reference types |
Solution
There are two data types in java:
Java arrays categorized as reference types. Arrays are handled “by reference” that is variables of their type store the address of the object or array is stored in a variable. They are passed by reference.
Example: char[] arr = { \'a\', \'b\', \'c\', \'d\' };
//\'arr\' stores the references for the 4 values.
| Example: char[] arr = { \'a\', \'b\', \'c\', \'d\' }; //\'arr\' stores the references for the 4 values. |
