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

through which algorithm does the garbage collector works? how the garbage collector will understand that the object will going to be deleted?

0 Answers   Motorola,


along with oracle which language will be beneficial to have knowledge with,java,.net,since i m doing oracle have appeared for 8th sem BEIT,plz suggest

0 Answers  


What is Partial class and its use?

1 Answers  


What are the advantages of Server Controls over HTML/ASP Controls.

1 Answers   Tesco,


In staad pro, how can we design ROOF SLAB?

0 Answers   L&T,






will it allow to add same value in HashMap class.

0 Answers  


what is session state?

0 Answers   HCL,


what is difference between kpo and it industry? that is in terms of work, package etc

0 Answers  


What is the client concept in SAP? What is the meaning of client independent?

3 Answers  


What is the merger sort principle and its time complexity.

0 Answers   Verifone,


About CLR, reflection and assemblies?

2 Answers   pspl,


What is the purpose of <Trigger> element of <updatePanel> in Ajax

0 Answers  


Categories