Page 372 - CA_Blue( J )_Class10
P. 372
24
25 }
26 }
27 }
28 }
29 }
You will get the following output:
Enter a number: 3
Enter a number: 5
Enter a number: 6
Enter a number: 8
Enter a number: 9
Enter a number: 3
Odd Number: 3 and its square is: 9
Odd Number: 5 and its square is: 25
Odd Number: 9 and its square is: 81
Odd Number: 3 and its square is: 9
15.4 SINGLE DIMENSIONAL ARRAY AND DOUBLE DIMENSIONAL ARRAY
Single Dimensional Array Double Dimensional Array
Contains single column and multiple rows. Contains multiple rows and multiple columns.
The variables are having same name with single subscript value. The variables are having same name with two subscript values
one for row and one for column.
To declare the array: To declare the array:
int ar[]=new int[10]; int ar[][]=new int[2][4];
15.5 DIFFERENT OPERATIONS ON ARRAY
The basic operations that can be performed on arrays are as follows:
• Searching
• Sorting
• Insertion
• Deletion
• Merging
15.5.1 Searching
Searching is the process through which an item can be searched from the group of items present in an array. An item
can be a number, a character, a word, etc. In Java, there are two types of searching techniques which are linear search
and binary search. Let us study them in detail.
370370 Touchpad Computer Applications-X

