Java
State true or false:
If a[] and b[] are two integer arrays, the expression a == b
compares the array elements.
Ans: False
In java two arrays cannot be compared with == logical operator. because it checks whether the two objects reference is same or not.,anyway two objects are not same so, it will return always false even though the two array elements are same
So, here we have to use Arrays.equals(a, b) where a,b are arrays
output:
using Arrays.equals(array1,array2):
output:
Get Answers For Free
Most questions answered within 1 hours.