ISC 2012 Object passing program
A class Combine contains an array of integers which combines two arrays into a single array including the duplicate elements, if any, and sorts the combined array. Some of the members of the class are given below:
ISC 2012 Question 8
ISC 2020 program: Convert day number to date
A class Combine contains an array of integers which combines two arrays into a single array including the duplicate elements, if any, and sorts the combined array. Some of the members of the class are given below:
Class name: Combine
Data Members/instance variables:
com[]: integer array
size: size of the array
Member functions/methods:
Combine(int nn): parameterized constructor to assign size = nn
void inputarray(): accepts the array elements.
void sort(): sorts the elements of the combined array in ascending order using the selection sort technique.
void mix(Combine A, Combine B): combines the parameterized object arrays and stores the result in the current object array along with duplicate elements, if any.
void display(): displays the array elements.
Specify the class Combine giving details of the constructor (int), void inputarray(), void sort(), void mix (Combine, Combine) and void display (). Also, define the main() function to create an object and call the methods accordingly to enable the task.
import java.util.*;
class Combine
{
static Scanner s=new Scanner(System.in);
int com[];
int size;
Combine(int nn)
{
size=nn;
com = new int[size];
}
void inputArray()
{
System.out.println("Enter numbers"+size+"times");
for(int i=0;i<size;i++)
{
System.out.println("Enter a number");
com[i]=s.nextInt();
}
}
void Mix(Combine A,Combine B)
{
int l=A.com.length;int l1=B.com.length;
for(int i=0;i<l+l1;i++)
{
if(i<l)
com[i]=A.com[i];
else
{
com[i]=B.com[i-l];
}
}
}
void sort()
{
for(int i=0;i<com.length;i++)
{
int c=-1;
int tmp=com[i];
for(int j=i+1;j<com.length;j++)
{
if(tmp>com[j])
{
tmp=com[j];
c=j;
}
}
if(c!=-1)
{
tmp=com[i];
com[i]=com[c];
com[c]=tmp;
}
}
}
void display()
{
for(int i=0;i<size;i++)
System.out.print(com[i]+"|");
}
public static void main()
{
System.out.println("Enter size for first array");
Combine A= new Combine(s.nextInt());
A.inputArray();
System.out.println("Enter size for second array");
Combine B=new Combine(s.nextInt());
B.inputArray();
Combine o=new Combine(A.size+B.size);
o.Mix(A,B);
o.sort();
o.display();
}
}https://www.youtube.com/watch?v=zEaeCL6Hb6s
https://youtu.be/GeSDLXhzFig
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.