daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class compare {
  2.    
  3.     public static void compare(int array1[], int array2[]) {
  4.        
  5.         int count = 0;
  6.        
  7.         if(array1.length == array2.length) {
  8.             for(int i=0; i<array1.length; i++) {
  9.                 if(array1[i] == array2[i]) {
  10.                     count ++;
  11.                 }
  12.             }
  13.         }
  14.        
  15.         if(array1.length == count) {
  16.             System.out.println("These arrays are equal.");
  17.         }
  18.        
  19.     }
  20.    
  21.     public static void main(String[] args) {
  22.        
  23.         int[] list1 = {1,2,3,4};
  24.         int[] list2 = {1,2,3,4};
  25.        
  26.         compare(list1,list2);
  27.     }
  28.    
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top