Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Michael McKenna
3,451 PointsWhat is the purpose of the choice class in Interactive Story?
The code below is as follows. I don't understand why we need it (because I'm not conceptualizing what is going on here). Any explanation will be greatly appreciated!
public class Choice { private String mText; private int mNextPage;
public Choice(String text, int nextPage) {
mText = text;
mNextPage = nextPage;
}
public String getText() {
return mText;
}
public void setText(String text) {
mText = text;
}
public int getNextPage() {
return mNextPage;
}
public void setNextPage(int nextPage) {
mNextPage = nextPage;
}
}
1 Answer

Michael McKenna
3,451 PointsYeah, this class has the getters and setters for the variables above. You can set the text here then get it from another point in your code with the getText() method. It's relatively simple, just don't over think it
Alex Johnson
6,067 PointsAlex Johnson
6,067 PointsI'm curious about this too so am digging into it right now. Did you ever figure out what exactly it does?