Java Challengers #23 - Java 12 switch case, Generics, Wrapper

preview_player
Показать описание
Go deep into Java 12 and learn how to use the switch case statement in a more concise way. By bonus, learn also Generics and Wrappers.

It's easy to learn Java by having fun with the Java challenges!

Get the code of the Java Challengers and run your own tests:

Watch them all!
Рекомендации по теме
Комментарии
Автор

This one took me more time than the others to understand, thanks to the debugging utility in intelij idea.


Could you explain to me this line :
break (T) (Object) (Integer.valueOf(129) == 129 ? 5 : 7);


What will be the result of the break statement, do we return from the method or do we break the switch.
For wich reason you convert the value to (Object) to (T) type. I tested without this conversion and it worked fine.


Thanks for the channel.

momedalhouma