Check out example codes for "How to find the length of an array in java". It will help you in understanding the concepts better.

Code Example 1

class Main {
  public static void main(String[] args) {
    // Creating an array called x.
    String[] x = new String[]{"This", "Should", "return", "4"};
    // "x.length" finds the length of the array "x".
    System.out.println(x.length);
    // returns 4
  }
}

Code Example 2

Int[] array = {1,2,3};
int lengthOfArray = array.length; /** Finding the length of the array and storing it */
System.out.println(String.valueOf(lengthOfArray)); /** Should print out 3, String.value Of() is optional as printLn does this automatically. */

Code Example 3

let coolCars = ['ford', 'chevy'];
//to find length, use the array's built in method
let length = coolCars.length;
//length == 2.

Code Example 4

arrayname.length

Learn ReactJs, React Native from akashmittal.com