Must-do problems: Static and Final
110 min · Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)Every problem asks you to choose, field by field, what belongs to each object and what belongs to the whole class, and what may never change. Decide that before writing code, test on the samples, and run every test before opening a hint.
What you will learn
- Decide for each field whether it belongs to every object or to the class
- Generate IDs and running totals with static counters and keep them correct
- Write utility classes of static methods with a private constructor
- Use static final constants and static blocks for rules and one-time set-up
Sign in to continue this lesson
Create an account to read every lesson, practise with the exercises and keep track of your progress.