Drill 9: Summarise — Syntax and control flow
Summarise the example in one sentence.
What you will be able to do
- Summarise the example in one sentence.
Practice task
Summarise the example in one sentence.
public class ControlFlow {
public static void main(String[] args) {
int minutes = 12;
String level = minutes < 10 ? "short" : "long";
if (minutes >= 14) {
System.out.println("deep dive");
} else if (minutes >= 8) {
System.out.println("steady lesson");
} else {
System.out.println("quick intro");
}
switch (level) {
case "short" -> System.out.println("under 10 minutes");
case "long" -> System.out.println("10 minutes or more");
default -> System.out.println("unknown");
}
int total = 0;
for (int i = 0; i < 3; i++) {
total += i;
}
while (total < 5) {
total += 1;
}
System.out.println(total);
}
}Your turn
EasyWrite your answer
Summarise the example in one sentence.
TEXT · starter
Your answer…Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.