📄 testclassref.java
字号:
/* * Just a quick sanity check that we don't break the precise gc because * of how we allocate class objects. * * @author Godmar Back */public class TestClassRef { Class c; Object o; static Class cs; static Object os; public static void main(String av[]) { /* the only point here is that the gc doesn't blow up. */ TestClassRef f = new TestClassRef(); f.c = Integer.TYPE; f.o = Integer.TYPE; cs = f.c; os = f.o; System.gc(); TestClassRef g = new TestClassRef(); g.c = java.lang.System.class; g.o = java.lang.System.class; cs = g.c; os = g.o; System.gc(); TestClassRef h = new TestClassRef(); h.c = TestClassRef.class; h.o = TestClassRef.class; cs = h.c; os = h.o; System.gc(); System.out.println("Success."); }}/* Expected Output:Success. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -