The order of stack frames

Report a typo

There is a small program with three methods:

public class Main {
    public static void main(String args[]) {
        printMult(3, 4);
    }
    
    public static void printMult(int a, int b) {
        System.out.println(mult(a, b));
    }
    
    public static int mult(int a, int b) {
        return a * b;
    }
}

Sort the lines in the order, in which stack frames will be pushed and removed to/from the call stack. The first operation should be on the top.

Put the items in the correct order
push main frame
push mult frame
push printMult frame
pop mult frame
pop main frame
pop printMult frame
___

Create a free account to access the full topic