Is there a way to adjust the spacing between new lines when outputting to the console through System.out.println
? I'm attempting to print out a square with a basic nested for-loop, but I keep getting a rectangle despite having the right number of characters. This is because the spacing between the characters is different than the spacing between lines. Any ideas?
Asked
Active
Viewed 968 times
-1

foobar5512
- 2,470
- 5
- 36
- 52
-
1Your current code would probably help. – Hanlet Escaño Aug 28 '15 at 18:45
-
Depends entirely on what console/IDE you are using, and its font. – bcsb1001 Aug 28 '15 at 18:48
-
This question may help - http://stackoverflow.com/questions/1014454/how-can-i-change-line-height-line-spacing-in-eclipse. – mvd Aug 28 '15 at 19:39
2 Answers
1
The standard output stream is just a stream of data; how that data is displayed is up to the application displaying it (e.g. a terminal or your IDE). You'll either have to settle for a rectangle, or find a different method of output than standard out.

Michelle
- 2,830
- 26
- 33
0
Without your current code, it's hard to say exactly whats going on. My first thought is, make sure you're using a character that is as high as it is wide, e.g. *
.
Second thought is (and again, I have no code to reference), see if you get the same result using one of the algorithms here: Printing a Square with loops, perhaps there is an issue with the square-printing logic that you overlooked.