Java Array get() Method

The get() method of Array class returns the value of the indexed component in the specified array object. If it has a primitive type. The value is automatically wrapped in an object.

Syntax

Parameter

array - the array

index - the index

Returns

value of the indexed component in the specified array

Throws

NullPointerException

IllegalArgumentException

ArrayIndexOutOfBoundsException

Example 1

Test it Now

Output:

sarr[0] = Java
sarr[1] = .net
sarr[2] = Python

Example 2

Test it Now

Output:

sarr[0] = 10
sarr[1] = 11
sarr[2] = 12




Latest Courses