Java AtomicInteger addAndGet() methodThe addAndGet() method of Java AtomicInteger class atomically adds the given value to the current value. SyntaxParametersdelta - It is the value to add ReturnIt returns the updated value. Example 1Test it NowOutput: when initial value is 0: 2 Example 2Test it NowOutput: when initial value is 100: 102 Example 3Test it NowOutput: when initial value is 100: -100 Example 4Test it NowOutput: when initial value is -100: -94 Example 5Test it NowOutput: when initial value is -100: -200 Next TopicJava AtomicInteger |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India