Java Array set() Method

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

Syntax

Parameter

array - the array

index - the index into the array

value - the new value of the indexed component

Returns

Does not return any value.

Throw

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException -

Example 1

Test it Now

Output:

Before Setting : JavaTPoint
After Setting : JavaforPoint

Example 2

Test it Now

Output:

obj:3
Array :: [1, 2, 1]




Latest Courses