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

Can a class be private in java?

550


How does enum work in java?

552


What is the difference between delete and delete[]

586


Can you use this() and super() both in a constructor?

525


what is server side caching?

1612






What is the multi-catch block in java?

539


What is a boolean used for?

592


What does indexof mean?

537


How does linkedhashmap work in java?

522


Can I override protected method in java?

603


Is array dynamic in java?

485


Describe 2 different ways to concatenate two strings.

690


Can you instantiate the math class in Java?

620


What is the final keyword?

559


How do I write a self declaration?

557