Omoops 3
Omoops 3
OBJECTIVE : To make students understand the basics of Arrays in Java and their major difference with
Arrays in C
Description :
Write the following about both 1D and 2D arrays : What are arrays in General.
Syntax of array declaration, creation and initialization
Static and dynamic initialization methods
Default initialisation
Write about arraycopy method(refer book of authorThampi) and Length Atribute
Difference between arrays in c and java
System.out.println(“Om Gaikwad”);
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the element to search: ");
int element = scanner.nextInt(); int index =
searchArray(array, element); if (index != -1) {
System.out.println("Element found at index " + index);
} else {
System.out.println("Element not found in the array");
}
scanner.close();
}
Output:
java.util.Scanner;
2D arrays
import java.util.Scanner;
System.out.println(“Om Gaikwad”);
System.out.println(“Om Gaikwad”);