diffrence b\w println() and printf()

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


Please Help Members By Posting Answers For Below Questions

What is the difference between method overriding and overloading?

824


Can we store variables in local blocks?

1044


how can you take care of mutual exclusion using java threads? : Java thread

812


What are abstract methods in java?

879


What loop means?

747


When object is created and destroyed?

834


How to sort an array from smallest to largest java?

779


What is the main use of java?

829


What is the difference between the ">>" and " >>>" operators in java?

731


What are the advantages of arraylist over arrays?

790


What are 3 data types?

750


Does java have a compiler?

786


What are heterogeneous objects?

791


What happens if we don’t override run method ?

765


How do you join strings in java?

752