How to check two arrays to see if contents have the same types and contain the same elements?

Q

How to check two arrays to see if contents have the same types and contain the same elements?

✍: Guest

A

One of options is to use the equals() method of Arrays class.
Arrays.equals(a, b);
If the array types are different, a compile-time error will happen.

2012-09-06, 2119👍, 0💬