Returns the element at the specified position in this list.
Syntax
Object get(int index)
Parameters
Index – The index at which the value needs to be returned.
Return Value
The value at the index position in the list.
Example
Following is an example of the usage of this method −
class Example { static void main(String[] args) { def lst = [11, 12, 13, 14]; println(lst.get(0)); println(lst.get(2)); } }
When we run the above program, we will get the following result −
11 13
Previous Page:-Click Here