Describe what an Interface is and how it?s different from a
Class.

Answer Posted / amit upadhyay

interface is collection of abstract method.we can not
define any method in interface.we can implement that
abstract method by using the class.there is a restriction
in interface that you have to implement all the abstract
method in the class which is declared in interface.and we
can not create an object of interface.if we want to execute
the interface method then we have to implement first that
interface in any class after that create the object of
class ,then we can access execute that method


but in class we have to define the methods, which is
declered.we can also access that method through the object
of the class.

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to find 2 power of a 5digit number with out using big int and exponent ?

2130


Can we override main method?

839


What is ambiguity in inheritance?

843


Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer

1899


How can you overcome the diamond problem in inheritance?

960


Where is pseudocode used?

737


write knight tour problem which is present in datastructure

2380


What does sksksk mean in text slang?

1835


Why do while loop is used?

772


What is the difference between inheritance and polymorphism?

795


How Do you Code Composition and Aggregation in C++ ?

24715


What is overloading and its types?

823


What is polymorphism and example?

776


Why it is called runtime polymorphism?

785


What is the difference between static polymorphism and dynamic polymorphism?

842