Java Array setByte() Method

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

Syntax

Parameter

array - the array

index - the index into the array

b - the new value of the indexed component

Returns

Does not return any value.

Throw

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException

Example 1

Test it Now

Output:

arr[0] = 1
arr[1] = 2
arr[2] = 3

Example 2

Test it Now

Output:

2




Latest Courses