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 53 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
Thanks for the timely response, appreciate it


billybob123

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

 

Did you know?

Fungal nail infections account for up to 30% of all skin infections. They affect 5% of the general population—mostly people over the age of 70.

Did you know?

The average office desk has 400 times more bacteria on it than a toilet.

Did you know?

Asthma cases in Americans are about 75% higher today than they were in 1980.

Did you know?

For pediatric patients, intravenous fluids are the most commonly cited products involved in medication errors that are reported to the USP.

Did you know?

Autoimmune diseases occur when the immune system destroys its own healthy tissues. When this occurs, white blood cells cannot distinguish between pathogens and normal cells.

For a complete list of videos, visit our video library