Java AtomicInteger incrementAndGet() methodThe incrementAndGet() method of Java AtomicInteger class increments the value by one and update the old value. SyntaxParametersThis will not take any arguments. ReturnIt will return the atomicInteger value after incrementing. Example 1Test it NowOutput: the updated number: 1 Example 2Test it NowOutput: the updated number: 21 Example 3Test it NowOutput: the updated number: 0 Example 4Test it NowOutput: the updated number: 3 Example 5Test it NowOutput: the updated number: -99 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