O'Reilly logo

Programming with Java by Sunil Patekar, Mahesh Bhave

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

CHAPTER 4

CONTROL STRUCTURES

In Chapter 3, we saw a few simple statements. In a program, these statements are executed one after the other. However, these statements are not sufficient to effectively solve the problems. To solve these problems, flow control statements are used. When we use them, statement to be executed need not be the very next statement. This gives tremendous power to the code.

Java supports many flow control statements. We can group these statements in the following manner.

  1. The first group consists of decision-making statements. Examples areIf-else and switch-case statements.
  2. The second group consists of looping statements. Examples arewhile, do-while, and for statements.
  3. The third group consists of branching statements Examples ...

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