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 Basics Perfecting the Prototype Censoring Words - Looping Until the Value Passes

Aditya Sheode
Aditya Sheode
1,291 Points

What is the difference between an object and a data-type?

I just wanted to know the prima facie difference and their relation to each other. I couldn't get an answer on stack overflow...

1 Answer

A 'data-type' is a type of data such as an integer, a boolean, or a character. It defines what values a variable of a 'data-type' can hold and what operations can be performed on it.

An object is an instance of a class. For example, we can think of 'person' as a 'class' and you & I are instances / objects of 'person' type. A 'class' can also be thought of as a blue-print of an 'object'; it defines certain attributes / properties and operations / methods that can be performed on the object. Hope this clarifies.