(Choose 1 answer)
Specify the correct implementation of pop() method of a stack. This stack uses java.util.ArrayList for storing data and the end of the list is treated as the top of the stack. (Choose the most suitable one)
A. Object pop()
{if (isEmpty()) return;return(pool.remove(pool.size()-1));}
B. void pop(Object x)
{ if (isEmpty()) return(null);}pool.remove(pool.size()-1);
C. Object pop()
{ if (isEmpty()) return(null);
}
return(pool.remove(pool.size()-1));
D. Object pop()
{ if (isEmpty()) return(null);return(pool.remove(pool.size()));
}
Exit 29