Java Program Problem Description Two arrays are strictly ide
Java Program Problem Description: Two arrays are strictly identical if their corresponding elements are equal. Write a program with class name StrictlyIdentical that prompts the user to enter two lists of integers of size 5 and displays whether the two are strictly identical. Use following method header to pass two arrays and return a Boolean. public static boolean equals(int[] array1, int[] array2) Method will return true if array1 and array2 are strictly identical otherwise it will return false. Here are two sample runs: Sample 1: Enter 5 elements of list1: 23 55 31 2 10 Enter 5 elements of list2: 23 55 31 2 10 Two lists are strictly identical. Sample 2: Enter 5 elements of list1: 23 55 31 2 10 Enter 5 elements of list2: 23 55 3 2 10 Two lists are not strictly identical.
Solution
importjava.util.Scanner;
 public class StrictlyIdentical
 {
 public static void main(String args[])
 {
 int[] a=new int[5];
 int[] b=new int[5];
 Scanner s=new Scanner(System.in);
 System.out.println(\"enter list 1 :\");
 for(int i=0;i<5;i++)
 {
 a[i]=s.nextInt();
 }
 System.out.println(\"enter list 2 :\");
 for(int i=0;i<5;i++)
 {
 b[i]=s.nextInt();
 }
 boolean flag=equals(a,b);
 if(flag)
 System.out.println(\"\  two lists are strictly identical\");
 else
 System.out.println(\"\  two lists are not strictly identical\");
 }
 public static boolean equals(int[] arr1,int[] arr2)
 {
 for(int i=0;i<5;i++)
 {
 if(arr1[i]!=arr2[i])
 return false;
 }
 return false;
 }
 }

