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: how to add methods to find photo post?

Hi

I have a school task in Java where i'm supposed to be able to find different photo post in a class called "NewsFeed". I have a total of 3 classes. "NewsFeed", "PhotoPost" and "Post". Im able to create different "Photo" object in the "PhotoPost" class, but they want me to write the code (Method) for being able find the post i "NewsFeed" class.

Can anyone help me?

thx.

And can you provide the code you have done so far?

1 Answer

Hi Anders,

have you tried to create a getter method inside Post class that returns a Post. Then create a new Post object in the class you need the object and call the getter method from the Post class ...