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 51 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
YES! Correct, THANKS for helping me on my review


amynguyen1221

  • Member
  • Posts: 355
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

According to animal studies, the typical American diet is damaging to the liver and may result in allergies, low energy, digestive problems, and a lack of ability to detoxify harmful substances.

Did you know?

According to research, pregnant women tend to eat more if carrying a baby boy. Male fetuses may secrete a chemical that stimulates their mothers to step up her energy intake.

Did you know?

Adult head lice are gray, about ? inch long, and often have a tiny dot on their backs. A female can lay between 50 and 150 eggs within the several weeks that she is alive. They feed on human blood.

Did you know?

Bacteria have been found alive in a lake buried one half mile under ice in Antarctica.

Did you know?

Over time, chronic hepatitis B virus and hepatitis C virus infections can progress to advanced liver disease, liver failure, and hepatocellular carcinoma. Unlike other forms, more than 80% of hepatitis C infections become chronic and lead to liver disease. When combined with hepatitis B, hepatitis C now accounts for 75% percent of all cases of liver disease around the world. Liver failure caused by hepatitis C is now leading cause of liver transplants in the United States.

For a complete list of videos, visit our video library