Question: 3.09 Consider the following widget class declaration and checkwidgets method, class widget private int widgets; public kidget (int) boolean okwidget = checkwidgets(w); if (okridget widgets
3.09 Consider the following widget class declaration and checkwidgets method, class widget private int widgets; public kidget (int) boolean okwidget = checkwidgets(w); if (okridget widgets = w; else System.out.println("Bad Widget Data"); private boolean checkwidgets(int w) return widgets > e; Is it correct to declare the checkwidgets method private? (A) It is not correct; it will not compile since all methods must have public access. (B) The syntax is correct; it compiles, but it is not logical to make the method private. (C) Making a method public or private is strictly a matter of personal opinion. (D) It is not correct; it will compile, but create a runtime error message. E It is correct. The private access is appropriate for an internal data check
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
