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 76 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
Wow, this really help


nathang24

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

 

Did you know?

The modern decimal position system was the invention of the Hindus (around 800 AD), involving the placing of numerals to indicate their value (units, tens, hundreds, and so on).

Did you know?

Calcitonin is a naturally occurring hormone. In women who are at least 5 years beyond menopause, it slows bone loss and increases spinal bone density.

Did you know?

Atropine, along with scopolamine and hyoscyamine, is found in the Datura stramonium plant, which gives hallucinogenic effects and is also known as locoweed.

Did you know?

Every 10 seconds, a person in the United States goes to the emergency room complaining of head pain. About 1.2 million visits are for acute migraine attacks.

Did you know?

Human stomach acid is strong enough to dissolve small pieces of metal such as razor blades or staples.

For a complete list of videos, visit our video library