I understand that, but I'm confused about how to go about it. What I don't understand is that if I create a string object called spaces, how do I get it to string.length() the previous line as it builds and then add 1 space to that? I believe my logic is correct but unsure of how to set it up.

I'm also working on another project where you have to build a rocket ship, which I have the sides but the top and bottom need to be triangles which I cannot figure out the spacing.

This is what I have so far... (it needs to look like the top-ish part, the code below I wrote only does the sides.)

/\
/ \
/ \
+------+
| |
| |
+------+
| |
| |
+------+
| |
| |
+------+
/ \
/ \
/ \
public class RocketShip {
public static void main(String[] args) {
String topbox = new String("");
for(int n=1; n<=8; n++)
{
if(n==1 || n==8)
{
topbox+="+";
}
else
{
topbox+='-';
}
}
String spaces = new String("");
for(int n = 1; n<=topbox.length()-2; n++)
spaces += ' ';
String sides = new String("");
for(int n = 1; n<=2; n++)
{
sides += '|' + spaces + "|\n";
}
System.out.println(topbox + '\n' + sides + topbox + '\n'
+ sides + topbox + '\n' + sides + topbox);
}
}