O'Reilly logo

Java 7 for Absolute Beginners by Jay Bryant

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

C H A P T E R  5

Control Flow, Looping, and Branching

Control flow, looping, and branching are fundamental concepts in all programming. Control flow consists of running different code under different conditions. Looping consists of running the same code (though often with different values or different objects each time) until some condition has been met. Branching consists of doing something else when some condition has been detected. The thread that ties them all together is detecting conditions.

Control Flow

Java offers two constructs for controlling the flow of a program.

  • if and if-else
  • switch

images Note try-catch blocks offer a form of control ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required