switchin Java was always considered not particularly useful prior to Java 5. In Java 5,
enumwas added to the language. This made it more useful to use
switchstatements, but was still incomplete. A feature request that has been long in waiting is the ability to use a
Finally, in Java 7 SE we get the ability to use a
switchstatement. This feature, I believe, will make the use of
switchmore prevalent in code which is post JDK 6.
The example below was developed using NetBeans 7.1 Beta on Oracle Solaris Express 11. The NetBeans Java project is located here: StringSwitch.zip.
This code was presented at the Greenville Java Users Group. The Unicode has a hidden message which is displayed when run.