The output that I get for this is...public class array{ public static void main(String args []){ int[] list1 = {12, 32, 14, 35, 89, 16, 120}; int[] list2 = {9, 12, 8, 17, 120, 35, 36}; System.out.println("The intersection of both is " + Intersection(list1 , list2)); } public static int[] Intersection(int list1[], int list2[]){ int[] section = new int[10]; int x = 0; for(int i = 0; i < list1.length; i++){ for(int j = 0; j < list2.length; j++){ if((list1[i]) == (list2[j])){ section[i] = list1[i]; } } } return section; } }
The intersection of both is [I@3bad086a
Process completed.