This is not a good assumption:
if(n == 1)
{
System.out.println(2);
n = 3;
}
Once you do correct the WA though this solution will get TLE because your inner loop will run for an incredibly long time for large primes closer to 10^9. You need a faster way to tell if a number is prime.