Solved

Given the ArrayStack Class Implementation Discussed in Section 16

Question 39

Multiple Choice

Given the ArrayStack class implementation discussed in section 16.3 (partially shown below) , select the statements needed to complete the push method. public class ArrayStack
{
Private Object[] elements;
Private int currentSize;
Public ArrayStack()
{
Final int INITIAL_SIZE = 10;
Elements = new Object[INITIAL_SIZE];
CurrentSize = 0;
}
Public void push(Object element)
{
GrowIfNecessary() ;
________________
________________
}
}


A) elements[currentSize] = element;
CurrentSize++;
B) currentSize++;
Elements[currentSize] = element;
C) elements[currentSize - 1] = element;
CurrentSize++;
D) elements[currentSize + 1] = element;
CurrentSize++;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions