+ 3

Can anyone help me in the indentation of this code? I mean the spaces between the numbers

https://code.sololearn.com/cP6J0XLYzSL2/?ref=app

4th May 2021, 1:44 PM
Atul [Inactive]
6 Antworten
+ 2
It is working for ("%-6s",a+" ");
4th May 2021, 2:20 PM
Atul [Inactive]
+ 2
But why can't we use print or println for it ? What is the necessity of using this? Is it specifically designed for spaces?
4th May 2021, 2:21 PM
Atul [Inactive]
+ 1
You can use format() System.out.format("%-5s", a+" ");
4th May 2021, 1:55 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
The format() is an easy way to format the output with C style, like printf() and sprintf(). It is included in console and string. string: https://www.javatpoint.com/java-string-format console: https://www.javatpoint.com/java-console-format-method
4th May 2021, 2:47 PM
你知道規則,我也是
你知道規則,我也是 - avatar
- 2
atul the%-5s is the format specifier of numerical data type and then we used increment or decrement
6th May 2021, 10:52 PM
Saad Arif
- 2
/t
11th May 2021, 10:53 PM
huzaifa Ali
huzaifa Ali - avatar