Q&A Categories

  • No categories

What’s the difference between an interface and an abstract class?

Jun

4

2013

What’s the difference between an interface and an abstract class in java ?

In: Uncategorized Asked By: [JASON] (Anonymously)
vote
Answer #1

First let’s set them apart cause one is a class and one is an interface .
You said abstract class . That is a class that’s declared abstract and it can’t be instantiated, but it can be subclassed. It can have an abstract method (which is method that is declared without an implementation )
An interface on the other hand is easy to be spoted because of the keyword “INTERFACE” and is defined as a group of related methods with empty bodies. An interfaces has to be implemented.

I hope that makes the difference for you.

Have a good one,

Answers Answered By: Sobolan_gri [ Grey Star Level]

 
vote
Answer #2

Abstract class – abstract class is declared by ‘abstract’ keyword and we can’t create object of it.inside abstract method may be abstract type or normal.
Interface – it declared as interface keyword and we can’t create object of it. inside interface method are by default public,abstract.so we can say that interface is pure abstract class

Answers Answered By: arif [3 Grey Star Level]

Answer this Question

Enter name & email to post an Answer. You can also Login / Join us

For a better management of this site please consider Logging in / Joining us before posting a Question. It makes everithing easier for us.

Please enter the captcha code bellow.
Logged in users don't have to use captchas. Don't have an account? Join us!

 

Link Exchange:

You can add url to the best of the internet directory. Our url is added under Reference Directory
HE Blog Directory WEB LOG SHOWWEB LOG SHOW