后端
SinyoungChen
这个作者很懒,什么都没留下…
展开
-
volatile
作用 JAVA 先写个Demo package demo; public class VolatileDemo { static volatile int value = 0; public static void main(String[] args) { value = 1; System.out.println(value); } } 关键就看对value的读写; 字节码 javap反编译一下 0: iconst_1 .原创 2021-03-07 22:49:08 · 152 阅读 · 1 评论 -
hashmap
put // table是保存在全局的数组 // Node是table中的元素,一个key对应一个Node final V putVal(int hash, K key, V value, boolean onlyIfAbsent, boolean evict) { //tab就是数组,n是数组长度 Node<K,V>[] tab; Node<K,V> p; int n, i;原创 2021-03-05 13:51:47 · 125 阅读 · 2 评论