Now we have covered switches and labelled breaks, we have covered all control flow aspects of Java. As mentioned in the lecture, switch statements are sometimes considered, and labelled breaks very often considered as things which should be avoided as they are to much like "goto statements". A goto statement enables control (the position in a program that is currently being obeyed) to move to any other point in the program. This is a hangover from seeing programs in terms of machine code, just long lists of instructions. Modern programming sees programs as structures, not just lists of statements, and the structure of a program would be damaged if it was possible to jump into the middle of a loop for example. Java does not have a goto statement, though other languages keep it in but good programmers hardly ever use it. The case against the goto statement was established in Edsger Dijkstra's paper Go To Statement Considered Harmful, which is considered to be the starting point of the move towards structured programming.
Matthew Huntbach 30th November 2000