android开发之对比版本号

  public static void main(String[] args)//
    {

        String s1 = "1.0.0";
        String s2 = "1.0.1";
        if (s1.compareTo(s2) > 0)
        {
            System.out.println(s1 + "大于" + s2);
        }
        else if (s1.compareTo(s2) == 0)
        {
            System.out.println(s2 + "等于" + s1);
        }
        else
        {
            System.out.println(s2 + "大于" + s1);
        }

    }

你可能感兴趣的:(android)