Question: 2. (03) Consider the following Widget class declaration class Widget private int widgets; private Widget (int w) widgets = w; public int getwidgets() { return
2. (03) Consider the following Widget class declaration class Widget private int widgets; private Widget (int w) widgets = w; public int getwidgets() { return widgets; } What is the problem with the Widget class declaration? (A) The syntax of the Widget class is wrong. It will not compile. (B) The constructor parameter should not be w. It must be named widgets. (C) There is no outside access to the Widget constructor. A Widget object cannot be constructed. (D) A Widget object can be constructed, but not executed. (E) The Widget class is unusual, but there is nothing wrong with the declaration
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
