In this example we will show the method to find the length of an array in Java.
Source Code
package com.beginner.examples;
public class ArrayLength {
public static void main(String[] args) {
String[] strs = {"a", "b", "c", "d"};
System.out.println(strs.length); // get the length of an array
}
}
Output:
4