Skip to main content

Java Topic Practice

Return Values

Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.

For practice use only.

Return Values MCQ Practice

Return Values Java practice with 15 questions, code tracing, and a worked explanation for every answer.

Question 1 of 15

Answered 0 of 15

Choose one answer.

Code Tracing 01 - Return Values: track the final printed value.

public class Main {
  public static int gap(int x, int y) {
      if (x > y) return x - y;
      return y - x;
  }
  public static void main(String[] args) {
    System.out.print(gap(18, 5));
  }
}
Choose one answer.