Checking why the output of a Java Switch statement is 2 lines instead of 1
Hello guys, In the code below the output is two lines when I think it should only be one. My code below is actually part of longer code, so here is a link to the full code: https://code.sololearn.com/cBOSiaYx4nFe but here is the output for this section of the code: You got the sliver medal. You got the bronze medal. So is it because I put case 3 before case 2? And it printed out case 2, because that was the 3rd case, but also case 3, because it matched the case of the medal number? medal = 3; switch (medal) { case 1: System.out.println("You got the gold medal."); break; case 3: System.out.println("You got the bronze medal."); break; case 2: System.out.println("You got the silver medal."); break; }