Answer Posted / mohneesh
printf in Java works exactly as in C.
it automatically formats your string, which is not possible
in println directly.
System.out.printf("%s\n\t%s","Mohneesh","Wadhwani");
Output:
Mohneesh
Wadhwani
where as you can use String Formatter to format String then
pass it to println to print.
| Is This Answer Correct ? | 16 Yes | 1 No |
Post New Answer View All Answers
Why string is a class?
How to remove the trailing spaces from a string?
Is singleton class immutable?
What is string data?
Can you create an object of an abstract class?
Why do we use return statement?
What is the loop in java?
What is difference between hashset and hashmap in java?
What is the symbol for line break?
What do you mean by default constructor in java?
Why hashmap is used in java?
What is the static field modifier?
Is string passed by reference in java?
Explain the use of sublass in a java program?
What is parse method?