Java Array setInt() Method

20 Mar 2025 | 1 min read

The setInt() method of Array class sets the value of the indexed component of the specified array object to the specified int value.

Syntax

Parameter

array - the array

index - the index into the array

i - the new value of the indexed component

Returns

Does not return any value.

Throw

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException -

Example 1

Output:

 2.0 , 7.0 , 9.0 , 

Example 2

Output:

 8 9 10