difference between printf and println in java?

Bhargav Modi picture Bhargav Modi · Feb 27, 2015 · Viewed 23.1k times · Source

Just came to know that java does has a method named printf, then what is the difference between printf & println?

Answer

Ryan Shukis picture Ryan Shukis · Feb 27, 2015

System.out.println(); is efficient for simply printing a line of text. If the line of text needs to be formatted (ex: alignment (left-justified, etc.), etc.), then System.out.printf(); would be used.

Check out this link for more information.