Sequence
This page is under construction. Please come back later.
In programming languages we have three ways to control the flow of statements: Sequence, Selection and Iteration. Sequence is the simplest and most basic flow control mechanism. It simply means that statements are executed sequentially in the order they appear in the program.
public class Sequence1 { public static void main(String[] args) { int x = 1; System.out.println("x: " + x); x = 2; System.out.println("x: " + x); x = 3; System.out.println("x: " + x); } }
Output
$ javac -Xlint Sequence1.java
$ java -ea Sequence1
x: 1
x: 2
x: 3
Questions
- {{Who's on first?}}
- {{Who's on second?}}
- {{Who's on third?}}
Projects
More ★'s indicate higher difficulty level.
References
- [[Java Language Specification]], Java SE 17 Edition, Gosling, et. al., 2021.
- [[Java Tutorials]]
- [[Java at TutorialsPoint]]
- Download Java at [[Amazon Corretto]], [[Azul Zulu]], [[Eclipse Temurin]] or [[Oracle JDK]]