Not a single test case passing code is working

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int row = n;
int col=n;
for(int i=0;i<n;i++){
System.out.println();
for(int j=0;j<n;j++){
if (i < row / 2)
{

                // checking if j<col/2 
                if (j < col / 2)  
                { 
                      
                    // print '*' if j=0 
                    if (j == 0) 
                        System.out.print(" *"); 
                          
                    // else print space 
                    else
                        System.out.print(" "+ " "); 
                } 
                  
                // check if j=col/2  
                else if (j == col / 2) 
                System.out.print(" *"); 
                  
                else
                { 
                    // if i=0 then first row  
                    // will have '*' 
                    if (i == 0) 
                        System.out.print(" *"); 
                } 
            } 
            else if (i == row / 2) 
                System.out.print(" *"); 
            else 
            { 
                  
                // middle column and last column  
                // will have '*' after i > row/2 
                if (j == col / 2 || j == col - 1) 
                System.out.print(" *"); 
                  
                // last row 
                else if (i == row - 1)  
                { 
                      
                    // last row will be have '*' if  
                    // j <= col/2 or if it is last column 
                    if (j <= col / 2 || j == col - 1) 
                        System.out.print("* "); 
                    else
                        System.out.print(" "+ " "); 
                }  
                else
                System.out.print(" "+" "); 
            } 
        } 
        System.out.print("\n"); 

}

}

}

import java.util.*;

public class Main {
public static void main(String args[]) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int row = n;
int col = n;
for (int i = 0; i < n; i++) {
//System.out.println();
for (int j = 0; j < n; j++) {
if (i < row / 2) {

				// checking if j<col/2
				if (j < col / 2) {

					// print '*' if j=0
					if (j == 0)
						System.out.print("*");

					// else print space
					else
						System.out.print(" ");
				}

				// check if j=col/2
				else if (j == col / 2)
					System.out.print("*");

				else {
					// if i=0 then first row
					// will have '*'
					if (i == 0)
						System.out.print("*");
				}
			} else if (i == row / 2)
				System.out.print("*");
			else {

				// middle column and last column
				// will have '*' after i > row/2
				if (j == col / 2 || j == col - 1)
					System.out.print("*");

				// last row
				else if (i == row - 1) {

					// last row will be have '*' if
					// j <= col/2 or if it is last column
					if (j <= col / 2 || j == col - 1)
						System.out.print("*");
					else
						System.out.print(" ");
				} else
					System.out.print(" ");
			}
		}
		System.out.print("\n");
	}

}

}

remove space between two “*”