Recall the Rectangle and Cube classes discussed earlier, as shown in Figure 10-18.
a) Is the following statement legal or illegal? If it is illegal, why? Rectangle r = new Cube(10, 12, 5);
b) If you determined that the statement in part a is legal, are the following statements legal or illegal? (Indicate legal or illegal for each statement.)
System.out.println(r.getLength());
System.out.println(r.getWidth());
System.out.println(r.getHeight());
System.out.println(r.getSurfaceArea());
c) Is the following statement legal or illegal? If it is illegal, why? Cube c = new Rectangle(10, 12);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.