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 is the difference between method overriding and overloading?
Can we store variables in local blocks?
how can you take care of mutual exclusion using java threads? : Java thread
What are abstract methods in java?
What loop means?
When object is created and destroyed?
How to sort an array from smallest to largest java?
What is the main use of java?
What is the difference between the ">>" and " >>>" operators in java?
What are the advantages of arraylist over arrays?
What are 3 data types?
Does java have a compiler?
What are heterogeneous objects?
What happens if we don’t override run method ?
How do you join strings in java?