Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) A1B1C1 b) A1B1C1C2 c) Runtime Error d) Compilation Error What is the output of this code? class A { public void firstMethod() { System.out.print(A1);

image text in transcribed

a) A1B1C1 b) A1B1C1C2 c) Runtime Error d) Compilation Error

What is the output of this code? class A { public void firstMethod() { System.out.print("A1"); } } class B extends A{ public void firstMethodo { System.out.print("B1"); } } class C extends A{ public void firstMethod() { System.out.print("C1"); } public void second Method() { System.out.print("c2"); } } A[] aArr = new A[3]; Arr[0] = new AO: aArr[1] = new BO; aArr[2] = new CO: for (A obj: aArr) { obj.firstMethod(); if (obj instanceof C){ Cc= (C) obj; c.second Method(); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

Why is a blind purchase order used as a receiving report document?

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago