摘要: Object类提供的toString()方法如下: public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } 如果我们直接打印一个对象,就会调用这个对象的toString()方法,如果我们没有为该类覆盖toString()方法, 我们可以看出toStri... 阅读全文
posted @ 2015-04-23 17:15 wangliyue 阅读(310) 评论(0) 推荐(0)
摘要: Object类的hashCode方法: public native int hashCode(); 是一个本地方法。 其中这个方法的主要注释如下: Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must... 阅读全文
posted @ 2015-04-23 15:44 wangliyue 阅读(1656) 评论(0) 推荐(0)