Properties — Introduction

Definition of fields, properties, getters and setters. Difference between fields and properties. Contrasting fields and properties in Java vs. Kotlin

Gabriel Shanahan
The Kotlin Primer

--

— — — — — — — — — — — — — — —

THE CURRENT VERSION OF THIS ARTICLE IS PUBLISHED HERE.

— — — — — — — — — — — — — — —

Tags: #KOTLIN FEATURE

This article is part of the Kotlin Primer, an opinionated guide to the Kotlin language, which is indented to help facilitate Kotlin adoption inside Java-centric organizations. It was originally written as an organizational learning resource for Etnetera a.s. and I would like to express my sincere gratitude for their support.

It is recommended to read the Introduction before moving on. Check out the Table of Contents for all articles.

First, some definitions, so we’re all on the same page:

  • when we talk about a field, we are referring to a block of memory that has a name, type, and size that corresponds to it.
  • when we talk about a property, we are talking about a value that’s presented to (and possibly consumed from) a place in code.

--

--