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

I got this error when I typed the code in eclipse

Exception in thread "main" java.lang.NullPointerException

1 Answer

Will be difficult to tell without looking at the code?
Null pointer error generally occurs when you try to use a reference that points to no location in memory (null) as though it were referencing an object. When we try and call a null method or use a pointer on a null reference it throws back the NullPointer error message.