Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class compare {
- public static void compare(int array1[], int array2[]) {
- int count = 0;
- if(array1.length == array2.length) {
- for(int i=0; i<array1.length; i++) {
- if(array1[i] == array2[i]) {
- count ++;
- }
- }
- }
- if(array1.length == count) {
- System.out.println("These arrays are equal.");
- }
- }
- public static void main(String[] args) {
- int[] list1 = {1,2,3,4};
- int[] list2 = {1,2,3,4};
- compare(list1,list2);
- }
- }
Add Comment
Please, Sign In to add comment