We just started learning references in Java and this one stumped me a bit. Any help is appreciated!
You iterate the array and use == to compare the first array member against all others.
If there is any mismatch, you can stop, knowing that at least one entry is not the same.
Use the method equals in Arrays utility class.
Equality operator will work to check if they have same reference and point to same object. eg:
array[0]==array[1]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.