Java AtomicInteger getAndAdd( ) methodThe getAndAdd() method of Java AtomicInteger class is used to atomically add the given number to the current value. SyntaxParametersdelta: It is the value to add. ReturnIt returns the previous value. Example 1Test it NowOutput: Updated number is: 100 Example 2Test it NowOutput: Updated number is: 20 Example 3Test it NowOutput: tUpdated number is: 0 Example 4Test it NowOutput: Updated number is: -220 Example 5Test it NowOutput: Updated number is: 20 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