Skip to content

[Item 7] 배열 원소의 참조를 해제하는 경우 #150

Answered by yerim123456
nusuy asked this question in Q&A
Discussion options

You must be logged in to vote

'값이 없음'을 의미하는 null을 대입한 경우, 해당 레퍼런스 변수가 참조하는 객체가 없다는 것일 뿐입니다. 그렇기에 참조를 해제하는 경우와 null을 대입하는 경우를 구분할 필요가 없을 것 같습니다. 만약, 이미 참조하는 객체가 있는 경우에는 참조를 해제하는 의미와 동시에 값이 없다는 의미를 갖게 됩니다. 만약, 처음 정의를 null로 했을 경우에는 그저 값이 없다는 의미만 갖게 된다고 생각합니다.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nusuy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Discussion Discussion Effective Java Effective Java
2 participants