Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Jari KoopmanPython Web Development Techdegree Graduate 29,349 Points
printf or println
In the video of Exceptions (Java, Craig Dennis) there is the part about when you put in too many PEZ. The following is written:
System.out.println(“Whoa there!); System.out.printf(“The error was: %s\n”, iae.getMessage());
I think somewhere in the course I missed something, cause I don't get the difference between println and printf. So is there anyone who can tell me the difference and when you use println and when printf?? Thank you!
printf prints a formatted string - that's why you can use %s and a load of other formatters within your output string.
println just prints out some text with a new line.
I hope that helps,