Day10 Arrays
Day10 Arrays
A Many Forms
B Single form
C No form
D Final Form
A Method overloading
B Method Overriding
C Constructors
D Static methods
Advantages
○ Code Optimization: It makes the code optimized, we can retrieve or sort the data
efficiently.
○ Random access: We can get any data located at an index position.
Disadvantages
○ Size Limit: We can store only the fixed size of elements in the array. It doesn't grow
its size at runtime.
1. arrayRefVar=new datatype[size];
// outer loop
for (int i = 1; i <= 5; ++i) {
// codes
// inner loop
for(int j = 1; j <=2; ++j) {
// codes
}
..
}
A int[] arr;
B int arr[];
C int arr;
D Array<int> arr;
Q2. What is the index range for the elements of an array in Java?
A 0 to length - 1
B 1 to length
C -1 to length - 1
D 0 to length