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
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 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
Rights 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
DOI: https://doi.org/10.1007/978-1-4302-6620-4_2
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-6619-8
Online ISBN: 978-1-4302-6620-4
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)