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

quadratic formula 9x²-6x-11=0
What are two methods that scientists use to predict volcanic eruptions
Classify the triangle based on side lengths 5, 7 and 8. A. right B. Acute C. obtuse D. no triangle can be formed with given side lengths
In humans, having freckles is the result of a dominant gene, and not having freckles is a recessive trait. If a freckled man who is homozygous for this trait ha
Linguistic semantics deals primarily with the _____ of words.A.structureB.meaningC.influenceD.relationship
What is the highest mountain in the United States and where is it located in the West region?
Why did the USA and the USSR fall out after World War 2?
The sum 9/10 and 1/32 is less than or greater than 1?
If you multiply me by 2, I become a number greater than 20 and less than 40 who am I
What is square root of 270