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

Method Return and Scope

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