JAVA Basic 강의자료] hashCode()
JAVA Basic 강의자료] hashCode()
실무개발자를위한 실무교육 전문교육센터학원
www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.
hashCode()
* hashCode()의 기능과 사용 예제
- hashCode()
= hash code value를 int형으로 반환
= public native int hashCode()
= hash code value : 객체가 가지는 유일한 참조값
= 객체의 메모리를 비교할 때 사용
<소스코드>
import java.util.*;
public class HashCodeTest{
public static void main(String[] args) {
System.out.println(“new Date() : ” + new Date().hashCode());
System.out.println(“new Object() : ” + new Object().hashCode());
System.out.println(“new Date() : ” + new Date().hashCode());
System.out.println(“new Object() : ” + new Object().hashCode());
}
}
'자바 > Java공부하기' 카테고리의 다른 글
JAVA Basic 강의자료] clone() (0) | 2016.09.12 |
---|---|
JAVA Basic 강의자료] finalize() (0) | 2016.09.12 |
JAVA Basic 강의자료] toString()의 사용 예제 (0) | 2016.09.12 |
JAVA Basic 강의자료] toString() (0) | 2016.09.12 |
JAVA Basic 강의자료] equals()의 사용 예제 (0) | 2016.09.09 |