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! While you're at it, check out some resources Treehouse students have shared here.

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

Java Java Arrays Iteration Looping Over 2d Arrays

3 Answers

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Michael Lee

%d is used in Strings formatting using printf() method.

It means that an int value is expected at that position in the string, the value of the int is specified after comma

e.g. System.out.printf("Michael has %d dollars and %d lamborghinis.", 50, 7);

You will the output on the console as:

Michael has 50 dollars and 7 lamborghinis.

You can also throw in a %s there if you like.

System.out.printf("%s has %d dollars and %d lamborghinis.", "Michael", 90, 4);

This will give you this:

Michael has 90 dollars and 4 lamborghinis.

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Seriously noob developer I didn't know who votes for the best answer, personally I have never voted any reply as a best answer but some of my answers have been voted for.

lol u were sarcastic

Hi, i have answered this question on ur previous theard. make this answer best answer as well XD