```
public class Prime 
{
    public static void main(String [] args)
    {
        int num = 3;
        int counter = 1;
        boolean flag = true;

        while(counter < 10001)
        {
            for(int i = 2; i < num; i++)
            {
                if(num%i==0)
                {
                    flag = false;
                }
            }
            if(flag)
            {
                counter++;
            }
            num++;
        }
        System.out.println(num);
    }
}

```

Whenever I run this code, no result is printed out. I'm assuming its because the code is inefficient, but I don't know what is wrong with this code.