public static void main(String[] args) { String t1="2.0.2"; String t2="2.1.2"; int result = t1.compareTo(t2); if(result > 0){ System.out.println("t1 > t2"); }else if(result < 0){ System.out.println("t1 < t2"); }else if(result == 0){ System.out.println("t1 = t2"); } }
java中字符串数字比大小(版本号比大小)
最新推荐文章于 2024-04-22 10:01:48 发布