← Back to Question List
Java Code Walkthrough #5
Method Return and Scope
📄 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 }67 public static void main(String[] args) {8 int num = 3;9 int result = mystery(num);10 System.out.println(num + " " + result);11 }12}