Question
What does the following piece of code do?for (int i = 0; i < arr.length-1; i++){ for (int j = i+1; j < arr.length; j++) { if( (arr[i].equals(arr[j])) && (i != j) ) { System.out.println(arr[i]); } }}
Answer: Option A
Was this answer helpful ?
The print statement is executed only when the items are equal and their indices are not.
Was this answer helpful ?
Submit Solution