面向对象 哈希码 getclass toString 的用法,getclasstostring
分享于 点击 2026 次 点评:56
面向对象 哈希码 getclass toString 的用法,getclasstostring
package com.java;
public class object20 {
public static void main(String[] args) {
Object o=new Object();
int hashCode1 = o.hashCode();
int hashCode2 = o.hashCode();
System.out.println(hashCode1);
System.out.println(hashCode2);
Object o1=new Object();
int hashCode3 = o1.hashCode();
int hashCode4 = o1.hashCode();
System.out.println(hashCode3);
System.out.println(hashCode4);
Class c = o1.getClass();
System.out.println(c.getName());
String string = o1.toString();
System.out.println(string);
String string2=o1.getClass().getName()+"@"+Integer.toHexString(o1.hashCode());
}
}
相关文章
- 暂无相关文章
用户点评