Java AtomicLong getAndDecrement() MethodThe getAndDecrement() method of Java AtomicLong class subtracts 1 from the AtomicLong value and returns its value before the subtraction. This method is equivalent to AtomicLong getAndAdd(-1) method. SyntaxReturnsthe previous value Example 1Test it NowOutput: Previous Value : 0 Example 2Test it NowOutput: Previous Value : 10 Example 3Test it NowOutput: Previous Value : -20 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