Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- equals
- MSA
- VUE
- DI
- jpa
- redis
- 인덱스
- KEVISS
- select_type
- StringBuilder
- SQL
- jwt
- AOP
- 재정의
- hashcode
- 열 속성
- docker
- stream
- cache
- 생성자 주입
- 필드 주입
- Spring
- 테스트 코드
- lambda
- Exception
- Test
- static
- 조합
- java
- DDL
Archives
- Today
- Total
목록tostring (1)
백엔드 개발자 블로그

toString 재정의 해야하는 이유 Object의 기본 toString메서드는 기본적으로 클래스 이름@16진수로 표현한 해시코드를 반환합니다. 실제로 Object.java파일의 toString메서드를 보면 다음과 같습니다. public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } 실제로 Car를 출력하였을 때 Car@6b71769e라는 결과가 나온 것을 확인할 수 있습니다. public class Car { private String name; private int position; } public class Main { public static void main(String[] arg..
Java
2024. 4. 4. 22:46