Java Tricky Program 5 - Ternary operator with null

preview_player
Показать описание
What will happen if we have a ternary operator condition in the method that should return int but one of the part is null.

Will it not compile, throw exception at runtime or behaves differently based on the the result of the condition. Check it out in the video.
Рекомендации по теме
Комментарии
Автор

What will happen if I change return type of foo method to Integer?

anilosta