Represent values with types and use branches and loops to choose the work to run.
Values and control flow
Variables and branches
A variable has a type and a value. A condition selects which branch executes.
int score = 72;
if (score >= 50) {
System.out.println("Pass");
} else {
System.out.println("Try again");
}Practice
Change the score to 49 and predict the output. Then write a loop that prints the values from 1 through 5.
Connected lessons
Continue with Java arrays and bounds, Java Tutorial.
Common Mistakes
Check empty inputs and invalid values before applying this operation to application data. State whether a method edits shared state or returns a separate value.
java
