Exercise 6 Name __________________ Score __/20
- public class Q1 {
- public static void main(String [] args) {
- Q2 qa = new Q2();
- qa.f1( 5 );
- Q2 qb = new Q2();
- qa.f2( qb, 4);
- }
- }
- class Q2 {
- int a;
- public int f1( int n ) {
- int i;
- int j;
- i = n;
- j = i + 1;
- this.a = n;
- return this.a;
- }
- }
- public void f2( Q2 q, int m ) {
- int i;
- i = q.f1(m);
- }
- }
qa.f1( 5 )
0 this=qa 1 n=5 2 i 3 j
qa.f1( 5 )
0 qa 1 TOS 5
qa.f2( qb, 4)
0 this=qa 1 q=qb 2 m=4 3 i
q.f1( m )
0 this=qb 1 n=4 2 i 3 j
qa.f2( qb, 4 )
0 qa 1 qb 2 TOS 4
q.f1( m )
0 qb 1 TOS 4
AMethodDecl
- Method sizeParams
- Method sizeVars
- Variable setOffset