0

How do you write tab in Java?

tried using \t but doesn't work

21st Jan 2021, 12:01 PM
Alif Vareza
Alif Vareza - avatar
3 Antworten
+ 5
You can add padding like this 👇 https://code.sololearn.com/cJ8Gaq6BazgP/?ref=app
21st Jan 2021, 12:10 PM
Minho
Minho - avatar
+ 4
You're welcome! This is how formatting works.. % is the format specifier. And %s means the format specifier for Strings. When an integer is placed between the % sign and the format conversion (e.g. %10s) then the code acts as a minimum-width specifier. This pads the output with spaces to ensure that it reaches a certain minimum length. https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html
21st Jan 2021, 12:26 PM
Minho
Minho - avatar
+ 2
it works perfectly, thank you so much
21st Jan 2021, 12:31 PM
Alif Vareza
Alif Vareza - avatar