Java AtomicLong getAndIncrement() MethodThe getAndAdd() method of Java AtomicLong class return current value and increments current value by 1. This method is equivalent to AtomicLong getAndAdd(1) method. SyntaxReturnsthe previous value Example 1Test it NowOutput: Return Value : 0 Incremented Value : 1 Example 2Test it NowOutput: Return Value : 10 Incremented Value : 11 Example 3Test it NowOutput: Return Value : -20 Incremented Value : -19 Next TopicJava AtomicLong Class |
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