Getting Wrong Answer in 💡 Prateek Sir and Coding

public static void Calculate(StacksUsingArrays stack, int q) throws Exception {

   //Write Your Code Here
   /* Donot initialize another Scanner use the static scanner already declared*/
		for(int i=0;i<q;i++)
		{
			int n=s.nextInt();
			if(n==2)
			{
				int c=s.nextInt();
				stack.push(c);
				continue;
			}
			if(stack.isEmpty())
			{
				System.out.println();
									continue;

			}
			int item=stack.pop();
			System.out.println(item);
		}

}