+ 1
Why this \t is not giving horizontal tab in Java?[Solved]
Here is my code and the \t is not giving me a gap of 8 spaces. Why please? https://code.sololearn.com/c3Z0I59OoPYx/?ref=app
7 Respuestas
+ 2
Martin Taylor I used Geany in the past, it should be similar I guess, matching your description.
+ 1
You forgot '{' and after it worked properly for me
+ 1
If I remember well
\t does not give 8 spaces but puts the text in the next column (whitch are 8, or 4, spaces away from each other)
So 1\t2 is
1 2
And 123\t3 is
123 4
+ 1
You can format it like this.
System.out.printf("%d%5s%c\n",(i-64),"",(char)i);
+ 1
Martin Taylor Thank you! I really wasn't aware of this characteristic of the code playground. Would you mind telling me if you ran it on any software or cmd?
0
Ananiya Jemberu Yes it was a typo but still there's a problem. Because the "\t" I have given is not giving me some output like this "1 A"
0
Angelo Yes exactly! But please tell me why it isn't giving output like:
"1 A"