Welcome back! In this course, we delve into Class Attributes and Methods in Java. These define an object's properties and behaviors. Our goal is to master the definition and application of these within a class. Through the construction of a CellPhone
class, we will navigate this exciting journey!
Class attributes
symbolize an object's properties. For instance, the attributes of a CellPhone
might be its brand
and model
:
Sometimes, attributes remain constant after initial set-up. The final
keyword aids in creating such attributes. Let's add a chargerType
attribute, which will be constant:
Methods
are a class's behaviors, while are its properties. For our , a method might be used to start a phone call:
