How to Read Java Class Version

Updated on Jan 8 2024. Actually, we can just use javap -v to get the version information. For example, $ javap -v Main.class Classfile /Users/luke/Developer/Learn/Spring/learn-spring-in-action-v4/chapter1/build/classes/java/main/com/hiwangzi/chapter1/Main.class Last modified Dec 8, 2023; size 1717 bytes SHA-256 checksum f6202b165f5e178e46a5f0d5b31c5112ffe23eb342f0b47afcc7b1084c63eb8a Compiled from "Main.java" public class com.hiwangzi.chapter1.Main minor version: 0 major version: 65 It is more convenient. $ javap -v Main.class | grep version minor version: 0 major version: 65 It is easy enough to read the class file signature and get these values without a 3rd party API....

July 11, 2022 · 2 min · Zi Wang

java.util.List 的 remove(int) 与 remove(Object)

最近看到 V2EX 上一个帖子《关于 Java foreach 循环删除多个元素的有趣问题(不是抛异常哦)》,我根据代码预测的执行结果与实际楼主贴出的并不相同。看了评论,才发现自己忽略了一点,觉得有点意思,因此记录一下。

July 8, 2018 · 2 min · Zi Wang

译|if(a - b < 0) 与 if(a < b) 的区别

一个针对此问题 Stack Overflow 上的回答。

May 8, 2018 · 2 min · Zi Wang