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


what does method and formatting mean

i didn't really understand what method and formatting strings meant, and i didn't understand the details about the "printf" command or method

1 Answer

Methods are procedures you can execute. You can also pass information into these methods. printf is a method that takes in a piece of text, known as a string, and prints the piece of text to the screen. Methods are covered in depth in the following course, so you don't really have to worry too much about them.

Formatting strings make sticking a piece of data inside a string more convenient. For example, if you have the string "Hello, " and you want to stick in the user's name after the hello, you could use formatting.

String name = "Aziz";
console.printf("Hello, %s!", name);

This would print, "Hello, Aziz!". Does this help you?

thanks a lot that really helped me!