CHAPTER 5

image

Statements

In this chapter, you will learn:

  • What statements are in Java
  • About the different types of statements available in Java, for example, control flow statements, loop statements, and so on.

What Is a Statement?

A statement specifies an action in a Java program, such as assigning the sum of x and y to z, printing a message to the standard output, writing data to a file, etc.

Types of Statements

Statements in Java can be broadly classified into three categories:

  • Declaration statement
  • Expression statement
  • Control flow statement

Declaration Statement

A declaration statement is used to declare a variable. You have already been ...

Get Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.