Interesting Merge two array program
Merge two array program: solved Java program for ISC Class 11 Computer Science with complete BlueJ code, explanation and sample output.
Merge two array program
Matrix programs
Write a program to accept two arrays from the user and merge them.
import java.io.*;
class merge
{
public static void main()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the length of the first array");
int n=Integer.parseInt(br.readLine());
int Arr1[]=new int[n];
System.out.println("Enter the length of the second array");
int m=Integer.parseInt(br.readLine());
int Arr2[]=new int[m];
int merge=m+n;
int Arr3[]=new int[merge];
System.out.println("Enter the values for the first array");
for(int i=0;i<n;i++)
Arr1[i]=Integer.parseInt(br.readLine());
System.out.println("Enter the values for the second array");
for(int i=0;i<m;i++)
Arr2[i]=Integer.parseInt(br.readLine());
for(int i=0;i<n;i++)
Arr3[i]=Arr1[i];
for(int i=0;i<m;i++)
Arr3[n+i]=Arr2[i];
System.out.println("The merged array is");
for(int i=0;i<merge;i++)
System.out.print(Arr3[i]+"\t");
} }Output:
Enter the length of the first array
4
Enter the length of the second array
3
Enter the values for the first array
4
3
7
Enter the values for the second array
8
9
2
The merged array is
4 3 7 8 9 2
watch java videos
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.

ISC Class 11 Computer Science Sample Paper 2026-27 with Solutions
A full 70-mark ISC Class 11 Computer Science sample paper for the 2026-27 annual exam: MCQs, number systems, propositional logic, logic gates, Java classes, arrays, strings, searching and sorting, and computing ethics, with complete worked solutions.