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
What does the “static” keyword mean?
Can we extend a class with private constructor?
Why java is said to be pass-by-value ?
What is the common usage of serialization?
What are the advantages of autoboxing?
Why singleton pattern is better than creating singleton class with static instance?
Can a class have an interface?
what is mutual exclusion? How can you take care of mutual exclusion using java threads? : Java thread
How many types of keywords are there?
What are disadvantages of java?
What is the primitive type short?
What is private protected in java?
Can we define private and protected modifiers for the members in interfaces?
Difference between throw and throws?
Is a boolean variable?