你的题目补充是什么意思?
还是来看一些具体的例句吧
1,compare to:比喻为
eg,
He compared her to a summer day.
他将她比为夏天。
Scientists sometimes compare the human brain to a computer.
科学家有时将人脑比作电脑。
2,compare to /with :对比,比较
The police compared the forged signature with the original.
警察将伪造的签名与原来的作比较。
The committee will have to compare the Senate's version of the bill with the version that was passed by the House.
委员会需要将参议院议案的版本与下议院通过的作比较。
compare 后一般跟with 或者to . 表示比喻或对比,比较之意。 你结合以上例句体会一下好理解一点。
java中string和bigdecimal类只有compareTo方法,不知道你说的compare是哪儿看到的?