Answer:
class Main {
public static void main(String args[]) {
Deque<Integer> stack = new ArrayDeque<Integer>();
Random rand = new Random();
for(int i=0; i<10; i++) {
int n = rand.nextInt(100);
System.out.printf("%02d ", n);
stack.push(n);
}
System.out.println();
while(stack.size() > 0) {
System.out.printf("%02d ", stack.removeFirst());
}
}
}
Step-by-step explanation:
example output:
31 18 11 42 24 44 84 51 03 17
17 03 51 84 44 24 42 11 18 31