Java Reference
In-Depth Information
Chapter 5
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 using this type of statement. For example,
int num;
int num2 = 100;
String str;
 
Search WWH ::




Custom Search