Q:

Java Program to find the duplicate values of an array

0

Java Program to find the duplicate values of an array.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.*; 
public class demo1 
{
 public static void main(String[] args) 
 {
  int[] array = {2,4,5,7,5,4,2,1,3,7};
  for (int a = 0; a < array.length-1; a++)
  {
   for (int b = a+1; b < array.length; b++)
   {
    if ((array[a] == array[b]) && (a != b))
    {
     System.out.println("Duplicate Element : "+array[b]);
    }
   }
  }
 }    
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now