Examlex

Solved

Suppose the Following Java Code Was Used to Implement an Abstract

question 36

Short Answer

Suppose the following Java code was used to implement an abstract data type for a stack of integers:
class StackOfIntegers implements StackType
{
private int[] StackEntries = new int[20];
private int StackPointer = 0;
public void push(int NewEntry)
{
if (StackPointer < 20)
StackEntries[StackPointer++] = NewEntry;
}
A.What would be the value of the variable StackPointer associated with Stack after executing the statement
StackType Stack;

B.Then,what would be the value of StackPointer associated with Stack after executing the statement
Stack.push(5);


Definitions:

Related Questions