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

What is the final amount if 2024 is increased by 17% followed by a 15% decrease? Give your answer rounded to 2 DP.
escriba qué pasa cuando se respeta la dignidad y qué pasa cuando no se respeta la dignidad. Utiliza 4 ejemplos
[tex]x^{2}[/tex] = 6
what are the aims and objectives of nedlac​
how did the activities of farmers on the great plains contribute to the creation of the dust bowl of the 1930s?
Find the gravitational potential energy of a body of mass 25kg,kept at a height of 4m If g=10m/s'.
They bought a new car a.theyself b.theyselve c.themselve d.themselfs
what is the best way to learn and understand high school chemstry? ​
Choose all options that apply. Which of the following medications are considered high-alert medications? | a) Heparin b) Insulin c) Ibuprofen d) Penicillin
9 10 11 12 13 An international company has 21.100 employees in one country. If this represents 23.9% of the company's employees, how many employees does it have