/**
 * A switch statement - Using arrows ->
 */

public class Switch2
{
    public static void main(String[ ] args)
    {
        if (args.length == 0)                       //if no prameters are entered
        {
            System.out.println("Please enter 'yes' or 'no' on the command line");
            System.exit(0);
        }
        String param = args[0];                     //get param from 1st argument
        char input   = param.charAt(0);             //convert string to char

        switch(input)                                           //check the input variable
        {
            case 'y', 'Y' ->                                    //if y or Y
            {                                           
                System.out.println("You entered yes");
                System.out.println("Thank you for confirming");
            }                              
            case 'n', 'N' ->                                      //if n or N
            {                               
                System.out.println("You entered no");                              
                System.out.println("Cancelling your request");
            }                  
            default ->                                            //otherwise
                System.out.println("Please enter 'y' or 'n'");
        }                               
    }
}