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.

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. : )