Question: 11. Using the A, B, C, and D classes from the this section, what is the output of the following code frag- ment? public static
11. Using the A, B, C, and D classes from the this section, what is the output of the following code frag- ment? public static void main(String[args) { AD elements - (new BO), new DO, DO AO, Bw CO): for (int 1-0: 1 17. Suppose that the following variables referring to the classes from the previous problem are declared: Pond vari - neu Bay(); Object var2 = new Ocean(); Which of the following statements produce compiler errors? For the statements that do not produce errors, what is the output of each statement? ((Lake) var1) nethodio: ((Bay) vart).sethod1); ((Pond) var 2) method20: ((Lake) var) method20; ((Ocean) var2).sethod3(); 19. Imagine a Rectangle class with objects that represent two-dimensional rectangles. The Rectangle has width and height fields with appropriate accesssor and mutators as well as get Area and getPerimeter methods. You would like to add a Square class into your system. Is it good design to make Square a subclass of Rectangle? Why or why not? 11. Using the A, B, C, and D classes from the this section, what is the output of the following code frag- ment? public static void main(String[args) { AD elements - (new BO), new DO, DO AO, Bw CO): for (int 1-0: 1 17. Suppose that the following variables referring to the classes from the previous problem are declared: Pond vari - neu Bay(); Object var2 = new Ocean(); Which of the following statements produce compiler errors? For the statements that do not produce errors, what is the output of each statement? ((Lake) var1) nethodio: ((Bay) vart).sethod1); ((Pond) var 2) method20: ((Lake) var) method20; ((Ocean) var2).sethod3(); 19. Imagine a Rectangle class with objects that represent two-dimensional rectangles. The Rectangle has width and height fields with appropriate accesssor and mutators as well as get Area and getPerimeter methods. You would like to add a Square class into your system. Is it good design to make Square a subclass of Rectangle? Why or why not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
