In Java, you can find the length of an array using the `length` property. This applies to arrays of any type, including arrays of primitive types like `int[]`, `double[]`, etc., as well as arrays of objects.
Here’s an example of how to find the length of an array in Java:
public class Main { public static void main(String[] args) { // Example array int[] numbers = {1, 2, 3, 4, 5}; // Finding the length of the array int length = numbers.length; // Printing the length System.out.println("Length of the array: " + length); } }
In this example, `numbers.length` will return the length of the array `numbers`, which is 5. Similarly, for arrays of objects, you can use the same `length` property to get the length of the array.