8.2.2. WrClasses-WE2-P2

Subgoals for Writing a Class 2/4

  1. Name it

  2. Differentiate class-level (static) vs. instance/object-level variables

  3. Differentiate class-level (static) vs. instance/object behaviors/methods

  4. Define class variables (static) as needed ‘

    1. Name

    2. Data Type

    3. public / private / final

  5. Define instance variables (that you want to be interrelated)

    1. Name

    2. Data Type

    3. private

  6. Create constructor (behavior) that creates initial state of object

    1. public

    2. Same name as class

    3. No return type

    4. Default - no parameters

    5. Logic - initialize all variables

    6. Repeat as needed, adding parameters


Classes-WE2-P2

You have attempted of activities on this page