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 Getting There Object Inheritance

Aditya Puri
Aditya Puri
1,080 Points

What does "type" mean?

0:40 "All classes in JAVA inherit from a special type called object."

What does he mean by the word "type" here? Does type mean a class?

1 Answer

Yes, Objects are user defined types. You also have primitive types (like int).

If you made a vehicle class, and created an instance of it called ford, ford is of type Vehicle. If you then created another class called Car, with inherits from Vehicle, your Car class have everything a Vehicle type has, plus any additional stuff within Car.

Car will inherit Vehicle, Vehicle inherits Object, (so a Car is still inheriting from Object through Vehicle though this time as all classes implicitly extend Object if they have no other superclass)