Module 2 · Lesson 3 of 36/22 in the course~14 min
Module lessons (3/3)
Members static, final and Enum
Lesson preview5 hands-on exercises readyCourse Java · Module 2 — Fundamentals of OOP
Difference between class state (static) and instance, constants static final, and enum typed with fields and methods.
What you'll learn in this lesson
- Distinguish
staticmembers (belonging to the class) from instance fields/methods. - Use
finalcorrectly on primitive variables, object references, andstatic finalconstants. - Model closed sets of values using
enumequipped with fields, private constructors, and behavioral methods.
Overview
Not everything belongs to a single instance on the Heap: global counters, utility methods (Math.max), and shared constants belong to the integer class.
A member static lives only once per class and is accessible without creating objects (ClassName.method()):
Sections covered in this lesson
- 11. Fields and Methods
staticvs Instance - 22. The
finalModifier: Fixed Reference vs. Immutability - 33. Simple and Compact Enums
- 44. Rich Enums with
finalFields, Constructors and Methods - 5Try it yourself
Pro Lesson · Module 2 — Fundamentals of OOP
Unlock "Members static, final and Enum" and the full Course Java curriculum
Difference between class state (`static`) and instance, constants `static final`, and `enum` typed with fields and methods.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course Java plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.