switch case with multiple conditions code example

Example 1: java switch multiple values

switch (num) {
            case 5:
            case 2:
            case 3:
                System.out.println("5,2,3");
                break;
            case 4:
            case 6:
                System.out.println("4,6");
                break;
            case 1:
                System.out.println("1");
                break;
            default:
                System.out.println("Inavlid number");
                break;
        }

Example 2: switch case with multiple conditions

switch (measurement)
{
	case "oz":
		{
          qty = Math.round (qty * 28.3495);
          qty= (int)qty;
          measurement= "g";
          System.out.print(qty);
		}
	break;
	case "fl oz":
        {
          qty = Math.round (qty * 29.5735);
          qty= (int)qty;
          measurement= "ml";
          System.out.print(qty);
      	}
    break;
    default:
        {
          qty =(int)qty;
          System.out.print(qty);
        }
}//end switch case