Lecture 16
10
switch
•Easier to read than if - else if - else if … .
•Variable whose value you switch on must be int or char (or long or short)
•Remember the break statement, lest you fall through to next case (a common error)
•Java design flaw – should use { … block …}
•new keywords:
–default, case, switch, break
see JOI/examples/SwitchDemo.java
Not handing out SwitchDemo.java code.
Next to last bullet: switch syntax is a relic from C. Here’s what I think it should have been:

case (whatever) {
   // body
}