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 Objects Meet Objects Methods

What is the difference here between a field and an object? You seem to be using them interchangeably.

What is the difference here between a field and an object? You seem to be using them interchangeably.

Andrew Crossley
Andrew Crossley
6,244 Points

An object is an item in the real world. e.g a physical box, a physical cup. A field can be a variable called "cup" which relates to the real world object.

1 Answer

Field is just another name used for variable. Object is something completley else and to understand it let's use an analogy. If you think of a car you have the enginge which is an object. The engine has many diffrernt functions like ignite and turn of the car. In the same way object in codes has different objects to perform different functions. Mark this answer if understood. : )