Adding variables, or fields, to a custom class is no different than what we've already been doing with LearningCurve. The same concepts apply, including access modifiers, variable scope, and value assignments. However, any variables belonging to a class are created with the class instance, meaning that if there are no values assigned, they will default to zero or null. In general, choosing to set initial values comes down to what information they will store:
- If a variable needs to have the same starting value whenever a class instance is created, setting an initial value is a solid idea.
- If a variable needs to be customized in every class instance, leave its value unassigned and use a class constructor (a topic that we'll get to later on).
Every character class is going to need a few basic fields; it's your job to add them in the following section.