erm, well i don't know about ur
while loop is it necessary for ur assignment but i change it to
for loop it works fine.... hope u don't mind the
while and
for though.... but this is what i got just put this as ur
while loop
for (int i=0; i<squareSize; i++) {
System.out.print("X");
}
for (int i=1; i<squareSize-1; i++) {
System.out.print("\nX");
for (int j=1; j<squareSize-1; j++) {
System.out.print("-");
}
System.out.print("X");
}
if (squareSize != 1) {
System.out.println();
for (int i=0; i<squareSize; i++) {
System.out.print("X");
}
}