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

Im getting syntax errors here?

Okay, so let's throw an IllegalArgumentException from the drive method if the requested number of laps cannot be completed on the current battery level. Make the exception message "Not enough battery remains".

./GoKart.java:23: error: cannot find symbol throw new IllegalArgumentExecption("Not enough battery remains"); ^ symbol: class IllegalArgumentExecption location: class GoKart 1 error

public void drive(int laps) { // Other driving code omitted for clarity purposes int newCharge = mBarsCount - laps; if (newCharge < 0) { throw new IllegalArgumentExecption("Not enough battery remains");

} mBarsCount = newCharge; }

2 Answers

One thing that can be difficult to check is spelling errors. You have "IllegalArgumentEx*ecption" when it should be "IllegalArgumentExce*ption"

Thanks, I transposition error I missed that

No problem!