|
An Introduction to Developing Classes
with Examples in Java |
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
access class class-name
{
this can be used to disambiguate between
local variables/formal parameters and attributes with the
same name
this Revisited
.
operator (i.e., the membership operator) so must refer to
an object
new operator
A picture frame is used to display a picture. It always has a width and height (measured in inches). It may or may not have a matte/border (also measured in inches). If it has a matte, it is the same size on all four sides. One can calculate the visible area of a picture frame from its area and the area of the matte.
A picture frame may or may not have a stand.
One can calculate the cost of a picture frame from the amount of material used in the perimeter of the frame itself and the area of the glass.
A picture frame is used to display a picture. It always has a width and height (measured in inches). It may or may not have a matte/border (also measured in inches). If it has a matte, it is the same size on all four sides. One can calculate the visible area of a picture frame from its area and the area of the matte.
A picture frame may or may not have a stand.
One can calculate the cost of a picture frame from the amount of material used in the perimeter of the frame itself and the area of the glass.
A picture frame is used to display a picture. It always has a width and height (measured in inches). It may or may not have a matte/border (also measured in inches). If it has a matte, it is the same size on all four sides. One can calculate the visible area of a picture frame from its area and the area of the matte.
A picture frame may or may not have a stand.
One can calculate the cost of a picture frame from the amount of material used in the perimeter of the frame itself and the area of the glass.
toString() that returns a
human-readable String representation of all
of the (important) attributes
toString() Method
toString() method
equals() method
that returns true if the attributes are the
samecompareTo() method of objects
can be ordered
equals() Method
toString() methodequals() method
PictureFrame Class