Java Array getBoolean() Method

20 Mar 2025 | 1 min read

The getBoolean() method of Array class returns the value of the indexed component in the specified array object, as a boolean.

Syntax

Parameter

array - the array

index - the index

Returns

The value of the indexed component in the specified array

Throws

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException

Example 1

Output:

 sarr[0] = true sarr[1] = false sarr[2] = true 

Example 2

Output:

 arr[0] = true arr[0] = true arr[0] = false