import static java.lang.System.out;
class Common
{
static public void main(String args[])
{
int[] arr1={3,4,5,6,7,8,20};
int[] arr2={10,20,5,24,3,14,2,30,3};
for(int i=0;i<arr1.length;i++)
{
for(int j=0;j<arr2.length;j++)
{
if(arr1[i]==arr2[j])
{
out.println(arr1[i]);
break;
}
}
}
}
}
class Common
{
static public void main(String args[])
{
int[] arr1={3,4,5,6,7,8,20};
int[] arr2={10,20,5,24,3,14,2,30,3};
for(int i=0;i<arr1.length;i++)
{
for(int j=0;j<arr2.length;j++)
{
if(arr1[i]==arr2[j])
{
out.println(arr1[i]);
break;
}
}
}
}
}
0 Comment to "Java program to find common elements in two arrays."
Post a Comment