class A{ void me(){s.o.p("");} class B extends A{ void me()
{s.o.p(" ");} class M{ A a=new B(); B b=new A(); a.me();
b.mne();} what is the output of this, how?

Answers were Sorted based on User's Feedback



class A{ void me(){s.o.p("");} class B extends A{ void me() {s.o.p(" ");} class..

Answer / sk

B b=new A();

you cannot assign a superclass object to a reference of
subclass.

Is This Answer Correct ?    21 Yes 4 No

class A{ void me(){s.o.p("");} class B extends A{ void me() {s.o.p(" ");} class..

Answer / kay

class A
{
public virtual void me()
{ s.o.p(" hi");
}
}

class B extends A
{
public override void me()
{ s.o.p(" wat up!");
}
}

class M
{
A a = new B();
a.me();
B b = new A();
b.me();
}

//output :
hi wat up!

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More Programming Languages AllOther Interview Questions

what is the extension of SPDS Dynamic cluster tables?

0 Answers   IBM,


how many types of operating system are avaliable?

0 Answers   IBM,


Which method protects back button to retrieve old value from previous page in Struts.

0 Answers  


what are the advantages of sap on other software ?

0 Answers  


Question:Why is mapping required? Computer 'Paging' & 'Segmentation'. Question:Give the disadvantages of Havander's Strategies. Question: What do you mean by Belady's Anomaly. - Describe with example. Question: Discuss the various function of OS. Question: Give a brief discussion on schedulers & Dispatchers with respect to process management.

0 Answers  






what is posix?

1 Answers   HCL,


1. Consider the following input and generate the object code using single pass assembler. JOHN START 0 USING *,15 L 1,FIVE A 1,FOUR ST 1,TEMP FOUR DC F’4’ FIVE DC F’5’ TEMP DS ‘F END

0 Answers   Wipro,


It is possible to take number of controls added to form at run-time.ex-when user enter 6, 6 text boxes get added to form,next time number of controls get change as per user number enter. What is code for that?

0 Answers   Honeywell,


Info for guidewire documents and interview questions

1 Answers  


Difference of Console, web & windows applications?

0 Answers  


How to find the aerry size

1 Answers   Cap Gemini,


if 2 is passed as an argument to the method,void GC.Collect then what would be the result?

0 Answers  


Categories