The boolean method to check for an empty stack can be written as:

Consider a class that uses the following variables to implement an array-based stack:
String [] s = new String[100];
int top = 0;

A) return top;

B)
if (top == 0)
return true;
else
return false;

C)
if (s == null)
return true;
else
return false;

D)
if (s.length == 0)
return true;
else
return false;

B)
if (top == 0)
return true;
else
return false;

Computer Science & Information Technology

You might also like to view...

A device that allows many users on a LAN to centrally store and retrieve information is known as a

a. print server b. file server c. communications server d. none of the above

Computer Science & Information Technology

How many constructors does the Picture class have?

What will be an ideal response?

Computer Science & Information Technology