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 For Loops

Meaning on %n and %d in code

In For Loops code Craig used %d and %n. How does witch one does the i need to replace %d or %n.

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

As a note on grammar, 'witch' is an evil lady, 'which' is in context of a question.

2 Answers

Steven Stanton
Steven Stanton
59,998 Points

Sorry - yes %s should be used for Strings and %d is for integers. (My mistake). For further info you can check the documentation here: https://docs.oracle.com/javase/tutorial/java/data/numberformat.html

Bjørn Nielsen
Bjørn Nielsen
257 Points

I keep getting a Exception in thread "main" java.lang.NullPointerException at MiniGolf.main(MiniGolf.java:16) When typing in the exact same codes in Eclipse. Can someone help me?