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 Objects (Retired) Harnessing the Power of Objects Incrementing

./GoKart.java:18: error: int cannot be dereferenced Error ?

I'm following the java track and I was trying to increment a battery charge. and I don't have any idea what this error means

Brendon Butler
Brendon Butler
4,254 Points

Could you post your code?

1 Answer

Rebecca Rich
PLUS
Rebecca Rich
Courses Plus Student 8,592 Points

Usually this will happen if you try to call a method on an int (which is a primitive type). So for example, something like this:

int count = 1;
String counterText = "count" + count.toString();

The .toString() method call directly on the integer would throw that error. If that does not help you find your problem or if you have additional questions / code snippets, let us know!

Yes this was my problem thank you so much