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 Data Structures - Retired Organizing Data Serialization

Richard Groot
Richard Groot
4,432 Points

Incompatible types error...

Getting this error when I'm running this program and I thought I was doing exactly as he did while stopping to learn why we're doing it but now when I run I get this.

Example.java:28: error: incompatible types: Treets[] cannot be converted to Treet[]
Treet[] reloadedTreets = Treets.load();
^
./com/teamtreehouse/Treets.java:32: error: incompatible types: Treet[] cannot be converted to Tre ets[]
return treets;
^
2 errors

Here is my code https://w.trhou.se/8ju52081az

Any guidance would be greatly appreciated as this lesson is a lot to take in at once to say the least. Thank you in advance!

3 Answers

Kourosh Raeen
Kourosh Raeen
23,733 Points

Take a look at the definition of the load() method in Treets.java. The return type should be Treet[], not Treets[].

Richard Groot
Richard Groot
4,432 Points

Thank you. I don't know how I overlooked that. I'm gonna read into to make sure I fully understand why it did that and how to prevent it in the future! Thanks again!

Brett Connolly
Brett Connolly
12,874 Points

I ran into this same problem. Thanks for the reply, Kourosh Raeen !

Kourosh Raeen
Kourosh Raeen
23,733 Points

My pleasure! Happy coding!