Reverse A Stack Using

only one test pass please correct me where is the problem in my code

i have correct this, i have not take input proper i resolve this

for (int i = n; i > 0; iā€“) {
stack.push(i);
}
[4,3,2,1](<-top) will always be in stock. take input from Scanner

yes i got my fault thanks a lot