Java: Array size

This entry is part 12 of 54 in the series Learn Java

An important thing to keep in mind about arrays is that their length is fixed and there are no methods available to change their size.

In fact, the only array member that is regularly used is length, to obtain the size of the array.

package javaapplication11;

public class JavaApplication11 {

    public static void main(String[] args) {
        int[] a = {1,2,3};
        int size = a.length;
        System.out.print("Size of array: ");


Series Navigation<< Java: For each loop
Java: Switch statement >>

Leave a comment

Leave a Reply