/* * Switch case break where switch is using a String * Case must be a literal - or final if using a variable */ package caseswitchbreak2; public class SwitchCaseBreak2 { public static void main(String[] args) { String word = "Two"; final String word1 = "Two"; final String word2 = "Three"; switch (word){ case "One": { System.out.println("One"); break; } case word1: { System.out.println("Two"); break; } case word2: { System.out.println("Three"); break; } case "Four": { System.out.println("Four"); break; } case "Five": { System.out.println("Five"); break; } } // end case } } ======================================================================= OUTPUT run: Two BUILD SUCCESSFUL (total time: 0 seconds)