You are viewing a single comment's thread. Return to all comments →
can i know why you have used printf() in java?
Printf is supported in java and it is done for formatting the output we print on the screen. Like you use
System.out.println it moves the cursor on a new line after printing the statement
System.out.print keeps the cursor at the same line after printing the statement
Similarly System.out.printf is used to format the output like the one to be done in this question. You can also use System.out.format to format the output.
Hope you understand what I want to explain. Do ask again if you didn't :)