Skip to content

Commit 5848d5b

Browse files
author
Jossc
committed
有谁知道我的神魂颠倒。
1 parent f2f6e4c commit 5848d5b

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/main/java/com/basics/UnsafeTest/unsafe_voliate/UnsafeTestTwo.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ public static void main(String[] args) {
4141
int unsafeInt = unsafe.getInt(UnsafeTestTwo.class, anLong);
4242
System.out.println("anInt: " + unsafeInt);
4343
System.out.println("anLong : " + anLong);
44-
unsafeTestTwo.testSys();
44+
/* unsafeTestTwo.testSys();*/
45+
try {
46+
UnsafeTestTwo o = (UnsafeTestTwo) unsafe.allocateInstance(UnsafeTestTwo.class);
47+
//2055281021 --- 1554547125
48+
System.out.println("true or false :" +o.hashCode() + " hash" + unsafeTestTwo.hashCode());
49+
/* o.testSys();*/
50+
} catch (InstantiationException e) {
51+
e.printStackTrace();
52+
}
4553
}
4654

4755
public void testSys() {
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
package com.sun.proxy;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
/**
47
* @PACKAGE_NAME: com.sun.proxy
58
* @PROJECT_NAME: JavaCode
69
* @Date: 2018/4/9
710
* @author: chenzhuo
811
*/
9-
public class Test {
12+
public class Test<T> {
13+
public void main(String[] args){
14+
List<Integer> list = new ArrayList<>();
15+
list.add(1);
16+
}
17+
1018
}

0 commit comments

Comments
 (0)