To SuperMMX(笑天子) : 你看看JDK,compareTo的参数是String,不是Object。
int compareTo(Object o) Compares this String to another Object. int compareTo(String anotherString) Compares two strings lexicographically. int compareToIgnoreCase(String str) Compares two strings lexicographically, ignoring case considerations. 懒得说话了, 自己看吧.
To lyhook(问题人物) 你看看jdk.compareTo的参数有String,也有Object int compareTo(Object o) Compares this String to another Object. int compareTo(String anotherString) Compares two strings lexicographically. int compareToIgnoreCase(String str) Compares two strings lexicographically, ignoring case considerations.
这个方法, 但是实际上不是, 运行时当然就会出错了.
你看看JDK,compareTo的参数是String,不是Object。
Compares this String to another Object. int compareTo(String anotherString)
Compares two strings lexicographically. int compareToIgnoreCase(String str)
Compares two strings lexicographically, ignoring case considerations.
懒得说话了, 自己看吧.
你看看jdk.compareTo的参数有String,也有Object
int compareTo(Object o)
Compares this String to another Object.
int compareTo(String anotherString)
Compares two strings lexicographically.
int compareToIgnoreCase(String str)
Compares two strings lexicographically, ignoring case considerations.
我手边的这本参考书(java 2 命令详解)里只有String参数的,犯懒了,就没查JDK。谢谢各位,我给分。
An object is a class instance or an array.