What does the following piece of code do? [code] for (int i = 0; i < arr.length-1; i++) { for (int j = i+1; j < arr.length; j++)

What does the following piece of code do?
Code:
for (int i = 0; i < arr.length-1; i++)
{
    for (int j = i+1; j < arr.length; j++)
    {
        if( (arr[i].equals(arr[j])) &#038;&#038; (i != j) )
        {
            System.out.println(arr[i]);
        }
    }
}
A. Print the duplicate elements in the array
B. Print the element with maximum frequency
C. Print the unique elements in the array
D. Prints the element with minimum frequnecy
 

Tìm kiếm

Back
Top