Source code for SwitchExample3.java:

public class SwitchExample3
{
	public static void main(String args[])
	{
		// SwitchExample3
		int x = 2;
		switch (x)
		{
			case 0:
			case 2:
			case 4:
				System.out.println("small");
			case 6:
			case 8:
				System.out.println("even");
				break;
			default:
				System.out.println("odd");
		}
	}
}

Output from SwitchExample3.java:

small even

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the SwitchExample3 application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR