public class Main {
    public static void main(String[] args) {
        int numTiles = 8;
        for(int i=0; i<numTiles;i++){
            for(int j=0; j<numTiles;j++){
                if(i==0 || i==numTiles-1){
                    System.out.print("1");  
                }else if (i+j==numTiles-1){
                    System.out.print("1");              
                }else{
                    System.out.print(" ");
                }               
            }
            System.out.println();
        }
    }
}
I see that it starts off with a for loop that repeats depending on the value of numTiles. Then the second for loop repeats 8 times and prints out 8 1s. I do not understand the else-if and the else in the for-loop.
If I could get clarification on the else-if and else conditionals it would be appreciated.
 
     
    