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 (retired 2014) Learning the Language Simple Refactoring

Jason Roe
Jason Roe
1,257 Points

Types of classes

What is the point of different class types? public, default, abstract, and final?

2 Answers

william parrish
william parrish
13,774 Points

You are setting the various levels of access to the class among other things. Setting the class as public means that it, and its methods are visible to all other classes. The default constructor makes it visible to only other classes within the same package, setting the class to final makes it unable to be extended to another class.

A pretty good explanation is available here, that breaks it down into a example related to a bicycle. http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html

Jason Roe
Jason Roe
1,257 Points

Thank you very much!