AtomicReferenceArray get() method in Java with Examples
The get() method of a AtomicReferenceArray class is used to return the value of the element at index i for this AtomicReferenceArray object with memory semantics of reading as if the variable of index was declared volatile type of variable.
public final E get(int i)
Parameters: This method accepts the index i to get the value.
Return value: This method returns current value at index i.
Below programs illustrate the get() method:
value at 0 = 12 value at 1 = 13 value at 2 = 14 value at 3 = 15
value at 0 = AMAN value at 1 = AMAR
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.