public class Main { public static void main(String[] args) { String browserType = "chrome"; // Switch-case statement to select a browser switch (browserType) { case "chrome": System.out.println("Selected browser: Chrome"); break; case "firefox": System.out.println("Selected browser: Firefox"); break; case "ie": System.out.println("Selected browser: Internet Explorer"); break; default: System.out.println("Unsupported browser type: " + browserType); } } } // Output: Selected browser: Chrome
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter