Task 2 of 9 · 0 solved · 9 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

4.5 Static and toString — object counter

Total: 0 / 4 pts
Practice mode — check each part and get hints as you go.
Task

Add to Widget a static field count and a constructor that increases it by one every time a widget is built.

A static field belongs to the class, not to any single object — all widgets share one counter. The program builds three widgets and prints 3.

Your solution