How to Increment a class Integer references value in java from another method

后端 未结 10 622
攒了一身酷
攒了一身酷 2020-12-09 02:29
package myintergertest;

/**
 *
 * @author Engineering
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void          


        
10条回答
  •  旧巷少年郎
    2020-12-09 03:13

    You could use an AtomicInteger from java.util.concurrent.atomic. It has a 'incrementAndGet' method which is suitable for your showcase.

提交回复
热议问题