# [Java (OpenJDK 8)], 134 bytes <!-- language-all: lang-java --> a->{int b=a.length,i=0,j=0;for(;i++<b;){for(;j<b;j++){if(a[j].length()!=b||a[i].charAt(j)!=a[j].charAt(i))return false;}}return true;} [Try it online!][TIO-jkrr7qxy] [Java (OpenJDK 8)]: http://openjdk.java.net/ [TIO-jkrr7qxy]: https://tio.run/##tU/BboJAFLz7Fa@cdoMS75Qmm0oTEySmeGmMhwcuuhQXsyw2DfLt9Gmwp5r04ml29s17M1PgCSfVUepi@9lnJdY1LFDpdgSgtJUmx0xC3KZVVUrUYFhijdK79QaQ@x2paotWZRCDDqDHyUtLa5AG6JVS7@x@rILpuAimfl4Z5ivXfU593l5JQc/CdXmrcobrYjNsMP4UpOczrtXGy/ZohGUFfV0VA1ecG2kboyHHspZ@1w3UmoZY71OuY5OWlGuId6rUFg5U7Dc/8ktHgOS7tvLgVY31jjSxpWbaM0zLL7hJW@dtHoXO2Jm/hjOCKBQXCGezD6fj3L935/7kDwfxvnqwA3VIHmuRLEWyoKMEK0EokmUYEyarMIwIFyKO/uHWjbr@Bw "Java (OpenJDK 8) – Try It Online" ### Explanation: int b=a.length,i=0,j=0; //Create Variables for(;i++<b;){for(;j<b;j++){ //Nested Loop if(a[j].length()!=b||a[i].charAt(j)!=a[j].charAt(i)) //Is the grid valid? return false; //if not, return false }} return true; //if it gets this far, return true