Object 类
一、API文档中的Object类
- Object类是类层次结构的根类
- 所有类都直接或间接的继承自Object类
二、Object类中的方法
- public int hashCode():返回该对象的哈希码值(对象的逻辑地址值)
- public final Class<?> getClass():返回此 Object 的运行时类
- public String toString():返回该对象的字符串表示
三、hashCode方法
- public int hashCode():返回该对象的哈希码值(对象的逻辑地址值)
//Student.java
public class Student extends Object {
}
//StudentTest.java
public class StudentTest {
public static void main(String[] args) {
Student s1 = new Student();
Student s2 = new Student()