Monthly Archives: 7月 2017

java: instanceof, isinstance,isAssignableFrom的区别

instanceof运算符 只被用于对象引用变量,检查左边的被测试对象 是不是 右边类或接口的 实例化。如果被测对象是null值,则测试结果总是false。 形象地:自身实例或子类实例 instanceof 自身类  返回true 例: String s=new String(“javaisland”);       System.out.println(s instanceof String); //true Class类的isInstance(Object obj)方法,obj… Read More »

Java Garbage Collection Distilled

Serial, Parallel, Concurrent, CMS, G1, Young Gen, New Gen, Old Gen, Perm Gen, Eden, Tenured, Survivor Spaces, Safepoints, and the hundreds of JVM startup flags. Does this all baffle you when trying to tune the garbage collector while trying to get the req… Read More »