Java/2012.04 강좌

13일차 hashcode

Bohemian life 2012. 4. 20. 10:56
package com.test;

public class Exam1 {

	public Exam1(){

	}
	public static void main(String[] args) {
		Exam1 e1 = new Exam1();
		Exam1 e2 = new Exam1();

		System.out.println("클래스 이름"+e1.getClass());
		System.out.println("해시 코드"+e1.hashCode());
		System.out.println("객체 문자열"+e1.toString());
		System.out.println("");

		System.out.println("클래스 이름"+e2.getClass());
		System.out.println("해시 코드"+e2.hashCode());
		System.out.println("객체 문자열"+e2.toString());
		System.out.println("");

		System.out.println("객체 문자열"+e2);
		
		//toString() 의 정체
		System.out.println(e2.getClass().getName()
				+'@'+Integer.toHexString(e2.hashCode()));
	}//toString()x,y의 좌표를 알고 싶다.toString();
	 //x=10,y=20
}