Source Code
// main method
1public static void main(String[] args) {
2 int a = 4;
3 int b = 9;
4 int result = add(a, b);
5 System.out.println("Result: " + result);
6}
// add method
7public static int add(int x, int y) {
8 int sum = x + y;
9 return sum;
10}
CONSOLE OUTPUT
Call Stack
a → x (value 4 copied)
b → y (value 9 copied)
return value
13
↓
STACK BOTTOM