Question
Draw a simple graph showing the methods in stack for each of the check point in the table below, when a calling sequences is given
Draw a simple graph showing the methods in stack for each of the check point in the table below, when a calling sequences is given as: main calls m1 then calls m2; m1 calls m3; m2 and m3 does not call any other method. You dont need to worry about the grammar syntax of each method, since these methods are not necessarily written in Java.
Check point 1: after main is executing, before main calls m1;
Check point 2: after main calls m1, m1 not calling m3 yet;
Check point 3: after m1 calls m3, m3 not finished yet;
Check point 4: after m1 calls m3, m3 already finished;
Check point 5: after main finishes calling m1, before main calls m2;
Check point 6: after main calls m2, m2 not finished yet.
Check point 7: after main calls m2, m2 already finished.
Check point 8: after main itself finishes execution
void main(){ . m1(); m2(); .. } | void m1(){ .. m3() .. } | void m2(){
} | void m3(){
} |
The sign in the above table indicate here goes some code. The parameters of each method are omitted to save space, and the access modifier are also omitted in each method. Assume the above method invocations are valid. The syntax of the above methods are not necessarily in Java.
Now you need to draw of the stack diagram for the rest of the scenarios.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started