Some help me with 10/11


I like to know in wich case would the "default" option print to the console ---> System.out.println("Messi is in position..."); <---

public class Switch {
	public static void main(String[] args) {
		char penaltyKick = 'L';

		switch (penaltyKick) {

			case 'L': System.out.println("Messi shoots to the left and scores!");
			case 'R': System.out.println("Messi shoots to the right and misses the goal!");
			case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
				System.out.println("Messi is in position...");



The default will execute when all of the above cases are not met.

i.e. In this example, if penaltyKick is not equal to either 'L', 'R', 'C', then the default will produce "Messi is in position...".


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.