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