Skip to main content

Introduction to Objects

  • Chapter
  • First Online:
Advanced Topics in Java
  • 3361 Accesses

Abstract

In this chapter, we will explain the following:

  • What is a class, an object, a field, and a method

  • That an object variable does not hold an object but, rather, a pointer (or reference) to where the object is actually located

  • The distinction between a class variable (also called a static variable) and an instance variable (also called a non-static variable)

  • The distinction between a class method (also called a static method) and an instance method (also called a non-static method)

  • What the access modifiers public, private, and protected mean

  • What is meant by information hiding

  • How to refer to class and instance variables

  • How to initialize class and instance variables

  • What is a constructor and how to write one

  • What is meant by overloading

  • What is meant by data encapsulation

  • How to write accessor and mutator methods

  • How to print an object’s data in various ways

  • Why the tostring() method is special in Java

  • What happens when we assign an object variable to another

  • What it means to compare one object variable with another

  • How to compare the contents of two objects

  • How a function can return more than one value using an object

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 59.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    1There is no conflict in using the same name equals to compare Parts and Strings. If equals is invoked via a Part object, then the equals method from the Part class is used. If equals is invoked via a String object, then the equals method from the String class is used.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Noel Kalicharan

About this chapter

Cite this chapter

Kalicharan, N. (2014). Introduction to Objects. In: Advanced Topics in Java. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6620-4_2

Download citation

Publish with us

Policies and ethics