Trace the Code
Loop Logic
If / Else Reasoning
Debug the Idea
Vocabulary & Concepts
100

int x = 5;

x = x + 2;

System.out.println(x);


7

100

for (int i = 0; i < 3; i++) {

    System.out.println(i);

}


0
1
2

100

int x = 7;


if (x > 5) {

   System.out.println("A");

} else {

   System.out.println("B");

}


A

100

if (x = 5) {

    System.out.println("Hi");

}

= is used instead of ==.

100

What is a variable?

A place to store a value.

200

int a = 10;

int b = a - 3;

a = b + 1;

System.out.println(a);


8

200

int total = 0;

int[] nums = {2, 4, 6};

for (int n : nums) {

    total = total + n;

}

System.out.println(total);


12

200

int x = 4;

if (x % 2 == 0) {

    System.out.println("Even");

} else {

    System.out.println("Odd");

}


Even

200

for (int i = 0; i < 5; i++)

    System.out.println(i);


There are no curly braces.

200

What does a loop do?

Repeats code multiple times.

300

int x = 4;

int y = x * 2;

x = y - x;

System.out.println(x);


4

300

int x = 10;

int count = 0;

while (x > 2) {

    x = x - 2;

    count = count + 1;

}

System.out.println(count);


4

300

int score = 85;

if (score >= 90) {

    System.out.println("A");

} else if (score >= 80) {

    System.out.println("B");

} else {

    System.out.println("C");

}


B

300

public static int add(int a, int b) {

    System.out.println(a + b);

}


The method does not return anything.

300

What is the difference between return and System.out.println?

return sends a value back, println only prints.