Stack s=new Stack();
LinkedList qeue = new LinkedList();
public void pushCharacter(char ch) {
s.push(ch);
}
public void enqueueCharacter(char ch) {
qeue.addLast(ch);
}
public char popCharacter() {
s.pop();
return // ?11
}
Asked
Active
Viewed 35 times
1

Andrew Tobilko
- 48,120
- 14
- 91
- 142

Mohamed Maher
- 11
- 1
1 Answers
1
return s.pop();
Stack#pop
"removes the object at the top of this stack and returns that object as the value of this function". You must have a Stack<Character>
, though. Don't use raw types.

Andrew Tobilko
- 48,120
- 14
- 91
- 142
-
1Just to note this he also needs to cast it to `char` in this case since that is his return type for the method and he is using `Stack` not `Stack
`, or just define it correctly as `Stack – Nexevis Aug 22 '19 at 12:39` since thats what he wants anyway.