Chapter 3 |
Reference semantics
A variable refers to the specific location in memory where the value is stored.
Copy of an array
The reference semantics is important for example for making a copy of an array. If we need to copy an array, we can do:
- copy an array element by element;
- use method
arraycopy
from the classSystem
(check API); - use method
clone
from the classObject
(check API).
Useful link: How to Copy an Array in Java
Self-assessment
Take the test.
Chapter 3 |