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

Android Build a Simple Android App with Kotlin Improving Our Code Simple Refactoring: Creating a New Class

Enyang Mercy
PLUS
Enyang Mercy
Courses Plus Student 2,339 Points

Confused Did we make FactBook class or both factBook and getFact classes?

We copied from FunFactActivity class, so where exactly was the code pasted? FactBook or getFact class?

2 Answers

Yves Le Palud
Yves Le Palud
4,894 Points

Hi Enyang!

We made a class FactBook with a method call getFact(). This is a commun thing we do in object oriented programming (OOP) call encapsulation.

If you have never programme with java or other OOP language, I strongly recommend to learn java with the treehouse course made by Dennis Graig. He will explain every concept you might need.