Consider a class that uses the following variables to implement an array-based stack:

```
String [] s = new String[100];
int top = 0;

```
A)
if (top == 0)
throw new RuntimeException("Underflow");
top--;
String temp = s[top];
s[top] = null;
return temp;

B)
if (top == 0)
throw new RuntimeException("Underflow");
String temp = s[top];
top--;
s[top] = null;
return temp;

C)
if (top == 0)
throw new RuntimeException("Underflow");
return s[top-1];
top--;
s[top] = null;

D)
top--;
return s[top];

A)
if (top == 0)
throw new RuntimeException("Underflow");
top--;
String temp = s[top];
s[top] = null;
return temp;

Computer Science & Information Technology

You might also like to view...

A(n) ________ data macro can be attached to an event in a form

Fill in the blank(s) with correct word

Computer Science & Information Technology

A navigation bar is the part of a webpage that links to other webpages in a website

Indicate whether the statement is true or false

Computer Science & Information Technology