Source Code
import java.util.Scanner;
public class arrays {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int num[] = new int [5];
int num2[] = new int [5];
int count=0;
int count=0;
System.out.println("Enter 1st array Integer");
for (int i= 0; i < 5;i++ )
{num[i]=input.nextInt();
}
System.out.println("Enter 2nd array Integer");
for (int k=0;k<5;k++)
{ num2[k]= input.nextInt ();
}
for (int m =0; m < 5; m++)
{if ((num[0] ==num2[0]) || (num[4]==num2[4]))
{count++;
}
}
if (count > 0)
{
System.out.println("True");
}
}
}