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

Java Java Objects Harnessing the Power of Objects Exceptions

Jacob Leatherwood
PLUS
Jacob Leatherwood
Courses Plus Student 467 Points

there is no try errors...

I am getting a ton of errors based on what I did in the 'throw new IllegalArgumentException' section. Can you review my code to see where I went wrong?

https://w.trhou.se/87jonnermk

thank you!

1 Answer

You used a System.out.println(""); for a formatted string, you can't do that. Check this link to understand more about that better : https://teamtreehouse.com/community/difference-between-systemoutprintf-and-systemoutprintln.

To correct your code : (Lines 40 to 41 in Example.java)

System.out.printf("The error was %s",
                   iae.getMessage());

What did I do ? I change the method to System.out.printf(""); and I had a %s to display the error.