Java Array setFloat() Method

20 Mar 2025 | 2 min read

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

Syntax

Parameter

array - the array

index - the index into the array

f - the new value of the indexed component

Returns

Does not return any value.

Throw

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException -

NegativeArraySizeException

Example 1

Output:

 2.4000000953674316 , 7.400000095367432 , 9.399999618530273 

Example 2

Output:

 8.0 9.0 10.0 

Java Array setFloat() Method

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

Syntax

Parameter

array - the array

index - the index into the array

l - the new value of the indexed component

Returns

Does not return any value.

Throws

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException -

NegativeArraySizeException

Example 1

Output:

 276657 , 76576576 , 9768768 

Example 2

Output:

 88787 88788 88789