CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #21

Nested If Statements

mediumIf Statements

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 int x = 15;
4 if (x > 10) {
5 if (x > 20) {
6 System.out.println("big");
7 } else {
8 System.out.println("medium");
9 }
10 } else {
11 System.out.println("small");
12 }
13 }
14}

🎯 Your Answer