Switch

The Code

The code for the fourth class of Java is as follows:

package switch;

public class Switcher {

  /**
    * @param args the command line arguments
    */

  public static void main(String[] args) {
    
    /* A simple program used to demonstrate and allow 
      * students to alter a basic switch construct
      */
    String options = "Yes"; // String with fixed value

    switch(options) {
      case ("Yes"):
        System.out.println("Affirmative");
        break;

      case("No"):
          System.out.println("Negative");
        //break;

    }// End of switch
        
  }// End of main
}// End of class