+ 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

22nd Mar 2021, 7:01 PM
ltsRoy
ltsRoy - avatar
9 Respostas
+ 2
Martin Taylor I used Geany in the past, it should be similar I guess, matching your description.
23rd Mar 2021, 12:39 PM
ltsRoy
ltsRoy - avatar
+ 1
You forgot '{' and after it worked properly for me
22nd Mar 2021, 7:13 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 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
22nd Mar 2021, 7:13 PM
Angelo
Angelo - avatar
+ 1
You can format it like this. System.out.printf("%d%5s%c\n",(i-64),"",(char)i);
22nd Mar 2021, 7:30 PM
Avinesh
Avinesh - avatar
+ 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?
22nd Mar 2021, 8:52 PM
ltsRoy
ltsRoy - avatar
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"
22nd Mar 2021, 7:17 PM
ltsRoy
ltsRoy - avatar
0
Angelo Yes exactly! But please tell me why it isn't giving output like: "1 A"
22nd Mar 2021, 7:19 PM
ltsRoy
ltsRoy - avatar