Java AtomicInteger getAndDecrement() methodThe getAndDecrement() method in AtomicInteger class gets the current value and decrement it by one. But it returns the value of atomicInteger before the subtraction. SyntaxReturnIt will return the currentValue first and decrement. Example 1Test it NowOutput: the updated number: 19 Example 2Test it NowOutput: the updated number: -1 Example 3Test it NowOutput: the updated number: 9 Example 4Test it NowOutput: the updated number: -2 Example 5Test it NowOutput: the updated number: -11 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