AtomicReferenceArray getPlain() method in Java with Examples
The getPlain() method of a AtomicReferenceArray class is used to return the value of the element at index i for this AtomicReferenceArray object with with memory semantics of reading as if the variable was declared non-volatile.
public final E getPlain(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 getPlain() method:
value at 0 = 987 value at 1 = 988 value at 2 = 989 value at 3 = 986
value at 0 = AMAN value at 1 = AMAR value at 2 = SURAJ
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.