Java Challenge #4: Switch Case

Switch case challenge – what will the result be? Don’t test the code. Answer the question by reading it!

Try to solve this challenge before seeing the answer below.

switch_case.jpg

Answer: “MnNeH”. Pretty easy, huh? But the “switch case” command can be tricky. The formula number of heisenberg is 50, so the second case will be executed until the break of the “case 5”, even if the condition is not true.

Written by
Rafael del Nero
Join the discussion

Stand Out as a Java Developer and Get Your Dream Job!

You will get the book by email in a few minutes after registering.