Back
To find integer array size in java you have to use arrayname.length
For example:
public class Main{public static void main(String[] args) {int[] array={1,2,3,4,5};for(int i=0;i<array.length;i++){ System.out.println(array[i]);} }}
public class Main
{
public static void main(String[] args) {
int[] array={1,2,3,4,5};
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
Interested to learn Java? Check out this java certification from Intellipaat.
31k questions
32.8k answers
501 comments
693 users