In-Class Java Exercise 2

Exercise · Explain This Java Method (Even Number)

Java · Beginner
Explain this code out loud like you're in a job interview. Focus on the condition, the modulo operator, and the returned value.
public class NumberCheck {

  public static boolean isEven(int number) {

    if (number % 2 == 0) {
      return true;
    } else {
      return false;
    }

  }
}
🎯 Instructions oral task
  1. Explain what the method checks.
  2. Describe what the parameter represents.
  3. Explain what % 2 means.
  4. Explain the if condition.
  5. Say what happens when the number is even vs odd.
📖 Vocabulary core
  • boolean — a value that is either true or false.
  • parameter — value passed into a method.
  • condition — logical test inside an if statement.
  • modulo operator — returns the remainder after division.
  • even number — divisible by 2 with no remainder.
🧩 Collocations natural English
  • check if a number is even
  • pass a value into a method
  • evaluate a condition
  • return true or false
  • divide a number by two
🗣️ Phrasal Verbs interview speech
  • check for — “The method checks for even numbers.”
  • work out — “We work out if the number is divisible.”
  • end up — “We end up returning true or false.”
  • pass in — “We pass in a number as input.”
🎤 Model Answer spoken

This method checks whether a number is even. It takes an integer called number as input and returns a boolean value.

Inside the method, it uses the modulo operator. The expression number % 2 calculates the remainder after dividing the number by two. If the remainder equals zero, that means the number is even.

If the condition is true, the method returns true. Otherwise, it returns false. So overall, this function determines if a number is divisible by two.