Doublehranch5402 Doublehranch5402
  • 24-02-2020
  • Computers and Technology
contestada

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

Respuesta :

colocho08
colocho08 colocho08
  • 03-03-2020

Answer:

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

}

}

}

Answer Link

Otras preguntas

Don Fernando what a answer
8. List two examples f of personification found in Act II, Scene​
If you flip a coin 56 times, what is the best prediction possible for the number of times it will land on tails?
Which of the following angles is not coterminal to 120° A 180° B. 240° C. 840° D. - 600°
Factories and mills in the early 19 century employed women and children as well as men which statements are true about women and children in factories and mills
Please post detailed answers to the following questions. Please use complete sentences. 1 paragraph per question. Which type of tax system-regressive or progres
¿Qué papel desempeña la sirvienta en la vida de doña bárbara?​
When does Prince Charming like to eat children? on special occasions for breakfast with zucchini when roasted
Can someone give me 3 points in how fear is explored in Lord of the Flies and their quotations?
how to write an essay​