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

How to prevent to create multiple objects of a java class?

3 Answers   ASD Lab, TCS,


How to convert string to byte array and vice versa?

0 Answers  


What are the types of casting?

0 Answers  


Is 0 a prime number?

0 Answers  


Can we have static methods in an interface?

0 Answers  






Explain the difference between jdk, jre, and jvm?

0 Answers  


What is Collection interface?

1 Answers   Zensar,


Difference between this(), super()?

12 Answers   College School Exams Tests, Oracle,


What is the purpose of a transient variable?

0 Answers  


To what value is a variable of the Boolean type automatically initialized?

3 Answers  


What is java and why do we need it? Explain

0 Answers  


What is flag in java?

0 Answers  


Categories