Free Object-oriented basics lessonsObject-oriented basics · Stage 0 · Objects and references · Step 2
Constructors, this and static
How objects get built, what this refers to, and what changes when a member belongs to the class instead of an object. About 14 minutes.
A class has a static initialiser block and an instance initialiser block. You create five objects. How many times does each run?
- AStatic once, instance five times
- BBoth five times
- CBoth once
Show the answer
Static once, instance five times. Static set-up is per class; instance set-up is per object.
4 questions on this idea
Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.
Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve