Home » Java Array set() Method

Java Array set() Method

by Online Tutorials Library

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 : TutorAspire After Setting : JavaforPoint  

Example 2

Test it Now

Output:

obj:3  Array :: [1, 2, 1]  
Next TopicJava Array Class

You may also like