I have searched on internet but did not find something useful. I do not want to use collections. please help me out!
here's what i have written
class ArrayDemo3 { static void union(int x[], int y[]) { System.out.println("Union Elements:"); for(int i=0; i<x.length; i++) { for(int j=0; j<y.length; j++) { if(x[i]!=y[j]) System.out.println(x[i]); //else } } } static void intersection(int x[],int y[]) { System.out.println("Intersection Elements:"); for(int i=0; i<x.length; i++) { for(int j=0; j<y.length; j++) { if(x[i]==y[j]) System.out.println(x[i]); } } } public static void main(String... kl) { int p[]={2,5,7,8,5,1}; int q[]={5,8,2,0,1,6,3}; union(p,q); intersection(p,q); } }