This topic contains a solution. Click here to go to the answer

Author Question: Given the following classes and their objects:class C1 {};class C2 extends C1 {};class C3 extends C1 ... (Read 75 times)

Pineapplelove6

  • Hero Member
  • *****
  • Posts: 560

Question 1

Analyze the following code:

Circle c = new Circle (5);
Cylinder c = cy;

◦ The code has a runtime error.
◦ The code has a compile error.
◦ The code is fine.

Question 2

Given the following classes and their objects:

class C1 {};
class C2 extends C1 {};
class C3 extends C1 {};

C2 c2 = new C2();
C3 c3 = new C3();

Analyze the following statement:

c2 = (C2)((C1)c3);

◦ c3 is cast into c2 successfully.
◦ You will get a runtime error because the Java runtime system cannot perform multiple casting in nested form.
◦ You will get a runtime error because you cannot cast objects from sibling classes.
◦ The statement is correct.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by Pineapplelove6 on May 6, 2020

onowka

  • Sr. Member
  • ****
  • Posts: 353
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 64% of students answer this correctly




Pineapplelove6

  • Member
  • Posts: 560
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


Viet Thy

  • Member
  • Posts: 329
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

The people with the highest levels of LDL are Mexican American males and non-Hispanic black females.

Did you know?

No drugs are available to relieve parathyroid disease. Parathyroid disease is caused by a parathyroid tumor, and it needs to be removed by surgery.

Did you know?

Elderly adults are at greatest risk of stroke and myocardial infarction and have the most to gain from prophylaxis. Patients ages 60 to 80 years with blood pressures above 160/90 mm Hg should benefit from antihypertensive treatment.

Did you know?

There are more nerve cells in one human brain than there are stars in the Milky Way.

Did you know?

To maintain good kidney function, you should drink at least 3 quarts of water daily. Water dilutes urine and helps prevent concentrations of salts and minerals that can lead to kidney stone formation. Chronic dehydration is a major contributor to the development of kidney stones.

For a complete list of videos, visit our video library