
Java의 모든 레퍼런스 타입은 null을 가질 수 있다. 그렇기 때문에 null인 객체를 참조하면 NullPointerException이 발생한다. 지금부터 Java 14에 추가된 유용한 NullPointerException에 대해 살펴보자. 기존 NullPointerException public class NullPointerExceptionsExample { public static void main(String[] args) { Song song = new Song(); song.genre = new Genre(); System.out.println(song.genre.name.toUpperCase()); } static class Song { Genre genre; } static class G..
Java 12, 13에서 2번의 Preview를 통해 강화된 Switch 표현식이 Java 14에서 표준화되었다. 기존 switch 구문 public class SwitchExpressionsExample { public static void main(String[] args) { SwitchExpressionsExample example = new SwitchExpressionsExample(); example.printDay(Day.FRI); example.printDay(Day.TUE); example.printDay(Day.SUN); } public void printDay(Day today) { switch (today) { case MON: case TUE: case WED: case THUR..
- Total
- Today
- Yesterday
- 자바
- IntelliJ
- mapToObj
- 개발자
- 변경사항
- 목표
- 충북 콕! 콕!
- java
- 익명 클래스
- 스트림
- lambda
- modern java
- 계획
- flatMapToLong
- java14
- 중간 연산
- #예제 #example #가계부 #Account Book
- 다짐
- #React #ReactJS #리액트
- #배열 #array #map 함수
- 람다
- Java8
- 회고
- flatMapToInt
- flatMapToDouble
- Stream API
- jdk14
- import문
- flaMap
- 토이 프로젝트
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |