AtomicReference setPlain() method in Java with Examples Last Updated : 27 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The setPlain() method of a AtomicReference class is used to set the value of this AtomicReference object with memory semantics of setting as if the variable was declared non-volatile and non-final. Syntax: public final void setPlain(V newValue) Parameters: This method accepts newValue which is the new value to set. Return value: This method returns nothing. Below programs illustrate the setPlain() method: Program 1: Java // Java program to demonstrate // AtomicReference.setPlain() method import java.util.concurrent.atomic.AtomicReference; public class GFG { public static void main(String[] args) { // create an atomic reference object. AtomicReference<Long> ref = new AtomicReference<Long>(); // set some value using setPlain method ref.setPlain(999945678979L); // print value System.out.println("value = " + ref.get()); } } Output: Program 2: Java // Java program to demonstrate // AtomicReference.setPlain() method import java.util.concurrent.atomic.AtomicReference; public class GFG { public static void main(String[] args) { // create an atomic reference object AtomicReference<String> ref = new AtomicReference<String>(); // set some value using setPlain() ref.setPlain("String Buffer"); // print value System.out.println("Class = " + ref.get()); } } Output: References: https://docs.oracle.com/javase/10/docs/api/java/util/concurrent/atomic/AtomicReference.html#setPlain(V) Comment More infoAdvertise with us Next Article AtomicReference setOpaque() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-util-concurrent-atomic package Practice Tags : Java Similar Reads AtomicReference set() method in Java with Examples The set() method of a AtomicReference class is used to set the value of this AtomicReference object with memory semantics of reading as if the variable was declared volatile type of variable. Syntax: public final void set(V newValue) Parameters: This method accepts newValue which is the new value to 1 min read AtomicReference set() method in Java with Examples The set() method of a AtomicReference class is used to set the value of this AtomicReference object with memory semantics of reading as if the variable was declared volatile type of variable. Syntax: public final void set(V newValue) Parameters: This method accepts newValue which is the new value to 1 min read AtomicReferenceArray setPlain() method in Java with Examples The setPlain() method of a AtomicReferenceArray class is used to set the value of the element at index i to newValue. Both index i and newValue are passed as parameters to the method. This method set the value with memory semantics of setting as if the variable was declared non-volatile and non-fina 2 min read AtomicReference setOpaque() method in Java with Examples The setOpaque() method of a AtomicReference class is used to set the value of this AtomicReference object with memory effects as specified by VarHandle.setOpaque(java.lang.Object...). In this way value is set in program order, but with no assurance of memory ordering effects with respect to other th 1 min read AtomicReference setOpaque() method in Java with Examples The setOpaque() method of a AtomicReference class is used to set the value of this AtomicReference object with memory effects as specified by VarHandle.setOpaque(java.lang.Object...). In this way value is set in program order, but with no assurance of memory ordering effects with respect to other th 1 min read AtomicReference setRelease() method in Java with Examples The setRelease() method of a AtomicReference class is used to set the value of this AtomicReference object with memory effects as specified by VarHandle.setRelease(java.lang.Object...). This method has memory ordering effects compatible with memory_order_release ordering. Syntax: public final void s 1 min read Like