The relational operations on primitive data are ==, >=, <=, >, <, and !=. They compare two data values, when those values' type has an ordering. For example, integers are ordered by size or magnitude. The result of a relational operation is a boolean value: either True or False. The relational operators on objects like Strings are different, and they are expressed as methods. Pay special attention to the equality method, equals().
1. More about Objects and Classes
This chapter reinforces the topics introduced in the last two chapters, and discusses several new topics.
The Point
class is convenient for discussing these topics. But it is not a class that Advanced Placement students are expected to know and outside of this chapter and the next these notes do not use it again.
You have seen some of the material in this chapter before. But, don't rush through it. The purpose of this chapter is to review topics that you may still be somewhat unclear about.
Chapter Topics:
- The
Point
class - Class descriptions
- The
toString()
method - Changing the data in an object vs constructing a new object
- The
equals()
method - The
==
operator (again) - Aliases
Question 1:
In geometry, what is a two dimensional point?
Source: Bradley Kjell, http://programmedlessons.org/Java9/chap42/ch42_01.html This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 License.