JAVA Object类 toString()

//仅作为学习笔记

class Demo //extends Object
{

}


class Test
{
	public static void main(String []args)
	{
		Demo d1 = new Demo();

		Class c = d1.getClass();

		System.out.println(c.getName());//获取类名
		
		System.out.println(d1.toString());

		System.out.println(d1.hashCode());

		System.out.println(d1.getClass().getName() + "@" + Integer.toHexString(d1.hashCode()));

	}
}


你可能感兴趣的:(JAVA Object类 toString())