package com.demo.atomic;
import java.util.concurrent.atomic.AtomicInteger;
public class AtomicDemo {
private static int count = 0;
private static int synchronizedCount = 0;
private static AtomicInteger atomicCount = new AtomicInteger();
public static synchronized void addCount() {
synchronizedCount++;
}
public static void main(String[] args) {
// 创建5个线程
Thread[] threads = new Thread[5];
for (int i = 0; i {
for (int j = 0; j
关注
打赏
热门博文
- Python:ULID通用唯一词典排序标识符
- Module not found: Error: Can‘t resolve ‘path‘
- 利用workflows工作流Actions自动部署Vue项目Deploy to GitHub Pages
- Vue2.js:前端在浏览器中网页表格打印的实现方案:window.print、print-js、iframe
- MacOS:使用内置的屏幕截图和屏幕录像功能
- css: Tailwind CSS一个功能类优先的 CSS 框架
- css:border-radius绘制边框圆角-全圆和椭圆
- PHP/Python/js:时间转为人类可读的字符串格式:刚刚、几分钟前、几小时前、几天前
- Golang:imaging一个简单、实用的图像处理工具
- element-plus:Dialog 对话框在有滚动条的页面会抖动