Skip to content

Declaring properties 'final'. #18

@pumken

Description

@pumken

Most classes that are not simply utility classes containing static methods contain properties that could be marked 'final' to make them immutable. Up until now, I have been avoiding declaring these fields 'final' because they might be given by the textbook as mutable variables.

However, this generates compiler warnings. Adding 'final' does not affect the semantics of the code, but does clarify that they are never modified.

At what point in the textbook is the keyword 'final' explained? Is it acceptable to declare these final?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions