compare index of two arrays return matches java

Solutions on MaxInterview for compare index of two arrays return matches java by the best coders in the world

showing results for - "compare index of two arrays return matches java"
Michela
28 Jan 2020
1public class compareArray{
2  public static void main(String[] args){
3    
4    int[a] = {1,4,5,7};
5    int[b] = {6,4,3,7};
6    
7    
8    int[] ab = new int[4];
9    
10    
11    for(int i = 0; i<a.length; i++; )
12    {   
13      if(a[i] == b[i])
14       { 
15        int[] ab = new int[4];
16        
17        Arraylist<Integer> al = new Arraylist<Integer>();
18        
19        for(int i = 0; i < a.length; i++; )
20          
21          if(a[i] == b[i])
22            
23          {  
24            al.add(a[i]);  
25                            }   
26                                  }
27      		Object[] c= al.toArray();
28      			
29      for(Object ob : c)
30      {
31        System.out.println(obj);
32      }
33    
34          
35    
36