| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 2015 봄학기 알고리즘
- til
- Counting cells in a blob
- data_structure
- 피보나치 수
- centuryFromYear
- adjacentElementsProduct
- C++
- Sequential Search
- 백준
- flask
- Python
- Daily Commit
- codesingal
- 수 정렬하기
- collections.deque
- 파이썬머신러닝완벽가이드
- shapeArea
- codesignal
- Numpy
- 2750
- 10953
- cpp
- almostIncreasingSequence
- recursion
- baekjun
- 파이썬 포렌식
- markdown
- matrixElementsSum
- All Longest Strings
Archives
- Today
- Total
Introfor
null 안전성 문제 본문
코틀린은 null 값을 가지는가 아닌가에 대한 명확한 표현이 변수에 적용된다.
val str1:String = "Hello, Kotlin"
str1 = null
위와 같은 코드를 입력하면 두 번째 라인은 빨간색으로 오류 표기가 되는 것을 확인할 수 있다.
이렇게 변수에 null 값을 넣는 방법은 다음과 같습니다.
var str1:String? = "Hello, Kotlin"
str1 = null
이렇게 자료형 뒤에 물음표를 명시해주면 된다.
Comments