a simple application to reverse numbers enter by user
public class reverseUsingStack {
private static void main(String[] args) {
Stack s = new Stack();
for (int i = 0; i < args.length; i++)
s.push(Integer.parseInt(args[i]));
while (! s.isEmpty())
System.out.println(s.pop());
}
}
in general a stack can be used in any situation that calls for a last-in, first-out discipline or that displays a nesting pattern e.g. parenthesis count (((((1)+(2))))); reversing a list 1234 to 4321; and implementation of recursion