Question

# Share code with your friends

Code

```				```
import java.util.Scanner;

public class Combine
{

int com[]=new int[100];
int size;
Scanner sc=new Scanner(System.in);

Combine(int nn)
{
size=nn;
com=new int[size];
}

void inputarray()
{
System.out.println("\nEnter "+size+" elements");
for(int i=0;i< size;i++)
{
com[i]=sc.nextInt();
}
}

void sort()
{
int t;
for(int i=0;i< size;i++)
{

for(int j=i;j< size;j++)
{
if(com[j]< com[i])
{
t=com[j];
com[j]=com[i];
com[i]=t;

}
}

}
}

void mix(Combine A,Combine B)
{
int x=0,y=0,z=0;
while(x< A.size)
{
com[z++]=A.com[x++];
}
while(y< B.size)
{
com[z++]=B.com[y++];
}
}

void display()
{

for(int i=0;i< size;i++)
{
System.out.print(com[i]+" ");
}
}

public static void main()
{
Scanner sc1=new Scanner(System.in);
System.out.println("\n enter size of first array");
int a=sc1.nextInt();
Combine P=new Combine(a);
P.inputarray();
System.out.println("\n Enter size of Second array");
int b=sc1.nextInt();
Combine Q=new Combine(b);
Q.inputarray();

Combine R=new Combine(a+b);
R.mix(P,Q);
R.sort();
System.out.println("Array 1:");
P.display();
System.out.println();
System.out.println("Array 2:");
Q.display();
System.out.println();
System.out.println("Combined Array:");
R.display();
}
}

```
```

Sale

50
Sale

150
Sale

200
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50