+ 3
Can anyone help me in the indentation of this code? I mean the spaces between the numbers
6 ответов
+ 2
It is working for ("%-6s",a+" ");
+ 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?
+ 1
You can use format()
System.out.format("%-5s", a+" ");
+ 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
- 2
atul the%-5s is the format specifier of numerical data type and then we used increment or decrement
- 2
/t