Chapter 6 - Java for Beginners Course

Introduction

Up until chapter 5 we haven’t defined or used a lot of interactions between the objects we’ve created and we’ve only created a handful of objects in our examples.

This of course has been helpful to introduce the concepts we’ve covered so far.

However, in most projects you’ll encounter, you’ll be handling more than a few objects and objects will interact with each other in different ways.

It is also important to understand some behaviors that the JVM and the Java libraries use/expect us to provide, and to understand some behaviors provided by the compiler for classes that come from the Java library.

In this chapter we cover these base object interactions and behaviors, including:

  1. Object casting and type comparison

  2. Object equality and hash codes

  3. Object String representation

  4. Introduction to garbage collection

  5. Comparing objects (less than, equals or greater than)

  6. Primitive Wrapper types and Autoboxing

Chapter 7 will introduce data structures that allow us to handle collections of objects for our applications.