Ask Question
7 September, 09:24

g what does the following piece of code do a) Print the duplicate elements in the array b) Print the element with maximum frequency c) Print the unique elements in the array d) None of the mentioned

+4
Answers (1)
  1. 7 September, 12:03
    0
    a) Print the duplicate elements in the array

    Explanation:

    I found this code:

    This is two for cycle, where we make a comparison among two variables i and j to print duplicate elements.

    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])

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “g what does the following piece of code do a) Print the duplicate elements in the array b) Print the element with maximum frequency c) ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers