what is difference between abstract and interface?
can i give real time example for the two topics?
Answer Posted / madhu samala
abstract is a keyword which can be applied to a class or a
class method. When we declare a class as an abstract one,
it may contain the abstract methods. Abstract method is a
method which contains only the declaration but not the
definition (body). The body for this method will be
provided in it's derived classes.
Note: An abstract class may not contain any abstract
method, but if it contains it must be declared as an
abstract class.
An interface is a contract. The contract will be between
the interface and the class.
An interface only contains abstract methods.i.e. They
contain only the method definition not the body.
The body for these methods must be provided inside the
class which implements that interface. If it doesn't
provide then it has to be declared as abstract.
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
How is treeset implemented in java?
What is methodological framework?
How to provide security in java
What are the rules for variable declaration?
What are the types of casting?
Can you use abstract and final both with a method?
What are the Static and Dynamic Variables? Differentiate them.
hi am an engineering student and my next plan is for ms in either in us or australia i got my passport but i dont know anything bout visa can u give brief idea 1)How to get prepared for visa and 2)How to apply for top universities and 3)How to pay the fee and so on These all are basic questions plz give me a clear idea
How do you declare an array that will hold more than 64KB of data?
Explain different states of a thread in java?
What is the scope or life time of instance variables?
Can we have any code between try and catch blocks?
Explain the difference between map and flatmap stream operation?
Explain the importance of import keyword in java?
what is the major difference between linkedlist and arraylist in java?