Java Array setBoolean() Method

The setBoolean() method of Array class is used to set the value of the indexed component of the specified array object to the specified boolean value.

Syntax

Parameter

array - the array

index - the index into the array

z - the new value of the indexed component

Returns

Does not return any value.

Throws

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException -

NegativeArraySizeException

Example 1

Test it Now

Output:

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

Example 2

Test it Now

Output:

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




Latest Courses