WAP to illustrate the use of interface

Answers were Sorted based on User's Feedback



WAP to illustrate the use of interface..

Answer / nsiddiqui69@yahoo.com

Interface inf1
{
void show();
}
class Derived implement inf1
{
void show1()
{
S.o.p("Derived class method");
}
public void show()
{
S.o.p("Interface method");
}
}
class infdemo
{
p.s.v.m(String args[ ])
{
Derived d1= new Derived();
d1.show();
d1.show1();
}
}

Is This Answer Correct ?    5 Yes 1 No

WAP to illustrate the use of interface..

Answer / siva mukesh

interface inf1
{
void show();
}
class Derived implement inf1
{
void show1()
{
S.o.p("Derived class method");
}
public void show()
{
S.o.p("Interface method");
}
}
class infdemo
{
p.s.v.m(String args[ ])
{
Derived d1= new Derived();
d1.show();
d1.show1();
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Why should we use singleton pattern instead of static class?

0 Answers  


Can we override static methods?

18 Answers   Bally Technologies,


List primitive java types?

0 Answers  


What are listeners in java and explain ?

2 Answers   TCS,


What is a java object and java application?

0 Answers  






Which oo concept is achieved by using overloading and overriding?

0 Answers  


What is local declaration?

0 Answers  


where final and static variable stored?

3 Answers  


A person says that he compiled a java class successfully without even having a main method in it? Is it possible?

0 Answers  


Why does java not support operator overloading?

0 Answers  


what is multitherading

3 Answers   Tech Mahindra,


Differentiate between a class and an object.

0 Answers  


Categories