CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Method Return and Scope

Java code walkthrough · Question 5
mediumFunctions

Code

Read carefully. What does this print?
1public class Main {
2 static int mystery(int x) {
3 x = x * 2;
4 return x + 1;
5 }
6 
7 public static void main(String[] args) {
8 int num = 3;
9 int result = mystery(num);
10 System.out.println(num + " " + result);
11 }
12}

Your answer