e
-
null 이란 무엇인가.CS-Theory 2022. 9. 29. 18:00
null 을 왜 사용 할까? 참고 자료 : https://www.youtube.com/watch?v=N08BSA3rwhU/ 1. 자바는 포인터가 없다? 자바,c# 둘다 포인터가 없을 뿐이지 , 자바의 모든 오브젝트는 레퍼런스를 사용한다 즉 포인터 개념이다 . 2. 포인터는 메모리주소를 저장 하는 변수이다. 포인터가 null 을 가르킨다 = 아무것도 가르 키는게 없다. => 포인터는 주소를 가르키거나 / invalid 한 상태 (null) null 이 탄생한거는 변수를 표현하면서 상태를 표현이 가능하다. 보통 함수는 리턴 값이 하나이다, 데이터가 없는 것을 어떻게 표현 할 것인가 ? == null 로 표현이 가능하다. -> boolean 으로 표현이 가능할텐데 함수를 하나 만들어서 상태를 판별 하는건 어떤..