Question: Question 7 & 8 use the code segment as a model (this is a study guide for the upcoming java test, i just dont have
Consider the following program segment, Widget and Stuff class for next 2 questions (#7 & 8) Widget widget - new Widget (100); public class widget Stuff stuff - new Stuff(widget); widget. setvidgets (280); private int widgets; System.out.println(widget.getWidgets()); public widget (int count) stuff.showWidgets(); widgets - count; public class Stuff private Widget widget; public int getwidgets() public Stuff (Widget w) return widgets; widget - W; public void setWidgets(int count) public void showWidgets() widgets - count; System.out.println(widget.getWidgets()); 3.004) 7.(09) What is printed as a result of executing the program? (A) e (E) zee 200 8.(10) This question is based on a program shown on the previous page. What computer science concept(s) is/are demonstrated by this program? "is a class relationship IL "has-a" class relationship III. Aliasing (A) I only (B) II only (C) III only (D) I and II only (E) II and III only
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
