FakeArrayList first = new FakeArrayl_ist(3); first.set(2, 7.1); first.set(l, 4.9); FakeArrayList second = new FakeArrayList(5); second.set(0, 9.1); second.set(1, 8.4);
Solution
class main_stack_frame
{ int identifier;
int address;
float contents;
public:
void set(int id,float cont)
{identifier=id;
contents=cont;
address=address;
}
}
class heap extends main_stack_frame
{ int identifier1;
int address1;
float contents1;
public:
void set(int id1,float cont1)
{identifier1=id1;
contents1=cont1;
address1=address1;
}
}
class test
{ public static void main(String args[])
main_stack_frame first= new main_stack_frame(3); // object of stack_frame class
heap second = new heap(5);// object of heap class
first.set(2,7.1);// calling set function of main_stack_frame
first.set(1,4.9)
second.set(0,9.1);// invoking set methd of heap class
second.set(1,8.4);
}
}
.