解决方案 »

  1.   

    按源码也等于0啊
    public static int compare(boolean paramBoolean1, boolean paramBoolean2)
      {
        return paramBoolean1 ? 1 : paramBoolean1 == paramBoolean2 ? 0 : -1;
      }
    假设paramBoolean1=TRUE,paramBoolean2=TRUE
    paramBoolean1 ? 1 : paramBoolean1这个表达式的结果是1
    1 == paramBoolean2 ? 0 : -1;这个表达式的结果是0没有问题啊
      

  2.   

    true>false false<true
    true==true false==false
    都是true,自然相等,没有小于对方,也没有大于对方,返回0.
      

  3.   

    引用 楼主 u010444251 的回复:
    话不多说直接进主题
            jdk1.7  eclipse luna
            关于compareTo方法的api文档解释是:
            如果对象与参数表示的布尔值相同,则返回零;如果此对象表示 true,参数表示 false,则返回一个正值;如果此对象表示 false,参数表示 true,则返回一个负值 
            java代码  System.out.println("new 
      

  4.   

    楼主不厚道啊!
    Boolean.java的源码:/**
         * Compares this {@code Boolean} instance with another.
         *
         * @param   b the {@code Boolean} instance to be compared
         * @return  zero if this object represents the same boolean value as the
         *          argument; a positive value if this object represents true
         *          and the argument represents false; and a negative value if
         *          this object represents false and the argument represents true
         * @throws  NullPointerException if the argument is {@code null}
         * @see     Comparable
         * @since  1.5
         */
        public int compareTo(Boolean b) {
            return compare(this.value, b.value);
        }    /**
         * Compares two {@code boolean} values.
         * The value returned is identical to what would be returned by:
         * <pre>
         *    Boolean.valueOf(x).compareTo(Boolean.valueOf(y))
         * </pre>
         *
         * @param  x the first {@code boolean} to compare
         * @param  y the second {@code boolean} to compare
         * @return the value {@code 0} if {@code x == y};
         *         a value less than {@code 0} if {@code !x && y}; and
         *         a value greater than {@code 0} if {@code x && !y}
         * @since 1.7
         */
        public static int compare(boolean x, boolean y) {
            return (x == y) ? 0 : (x ? 1 : -1);
        }不知道你的这个源码从哪里看的
      

  5.   

    擦,我是用反编译工具直接反编译rt.jar包的  看来这工具还是不值得相信啊