Dequeue efficient problem

How can i resolve run error?

import java.util.*;
public class Main
{
public static void main (String args[]) throws Exception
{
// Dequeue obj = new Dequeue();
Scanner sc= new Scanner(System.in);
int n= sc.nextInt();
for(int i=0;i<n;i++)
{
enqueue(sc.nextInt());
}
for(int i=0;i<n;i++)
{
System.out.print(dequeue()+" ");
}
}

static Stack s1= new Stack<>();
static Stack s2= new Stack<>();

public static void enqueue(int item) throws Exception
{
	try
	{
    while(!s1.isEmpty())
    {
    s2.push(s1.pop());
    }
    s1.push(item);
    
    while(!s2.isEmpty())
    {
        s1.push(s2.pop());
    }
	}
	catch (Exception e)
	{
		throw new Exception("queue is full");
	}
}

public static int dequeue() throws Exception
{
	try
	{
    int x=s1.peek();
    s1.pop();
    return x;
	}
	catch (Exception e)
	{
		throw new Exception ("queue is empty");
	}
}

}

can you please share the name of your runtime error?
thanks

Only Runerror was written there

try to declare your stack as
static Stack$Integer$ s1= new Stack$Integer$();
use angular brackets instead of $

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

My doubt is not cleared yet, it is still showing run error

@minal.251298 ,
2 Errors:

  1. While calling enqueue in the main method, you only to pass i instead of scn.nextInt. We don’t need to take input in that.

  2. Declare the type of stack as well. Stack of the type integer. Else it will give an error while performing the peek method or while popping values.

https://ide.codingblocks.com/s/205216 corrected code. I have also marked the errors in code and corrected them.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.