prakashrumma
Abstract and Interface
1 Answer(s)      2 years and 11 months ago
Posted in : Java Beginners

what is the difference between Abstract and Interface accurateatly?

Advertisement
View Answers

June 2, 2012 at 6:29 PM


Difference Between Interface and Abstract Class

1)Main difference is methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior.

2)Variables declared in a Java interface is by default final. An abstract class may contain non-final variables.

3)Members of a Java interface are public by default. A Java abstract class can have the usual flavors of class members like private, protected, etc..

4)Java interface should be implemented using keyword 'implements'; A Java abstract class should be extended using keyword 'extends'.

5)An interface can extend another Java interface only, an abstract class can extend another Java class and implement multiple Java interfaces.

6)A Java class can implement multiple interfaces but it can extend only one abstract class.

7)Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists.

8)In comparison with java abstract classes, java interfaces are slow as it requires extra indirection.










Related Tutorials/Questions & Answers:
Abstract and Interface
Abstract and Interface  what is the difference between Abstract and Interface accurateatly
Abstract and Interface
Abstract and Interface  What is interface? When time is most suitable for using interface? Why we use interface instead of abstract? What is the differences between abstract and interface?   An interface defines a set
Advertisements
Interface vs abstract class
Interface vs abstract class  Hai, Is there any possible to defining abstract methods in Interface
Interface and Abstract class
Interface and Abstract class  Difference between Interface and Abstract class? Give some example   Difference Between Interface and Abstract Class 1)Main difference is methods of a Java interface are implicitly
Interface and Abstract class
Interface and Abstract class  hello,, Can some body tell me what is the difference between an Interface and an Abstract class?   hi, Very Good Question Abstract class is a class which contain one or more abstract
Abstract class and interface in Java
Abstract class and interface in Java  What is the difference between abstract class and interfaces in Java?   Differences between an interface and an abstract class: At the same time multiple interfaces can
Interface Vs Abstract Class
Interface Vs Abstract Class       There are three main differences between an interface and an abstract..., an interface is equivalent to a fully abstract class (a class with only public abstract
abstract class and interface - Java Beginners
? when should we use an abstract class? when should we use interface instead... interface are abstract by default. Abstract method provides the standardization...() { System.out.println ("Moo! Moo!"); } } Why not declare an abstract class as an interface
What are the difference between abstract class and interface?
What are the difference between abstract class and interface?  What are the difference between abstract class and interface
Difference between abstract class and an interface
Difference between abstract class and an interface The difference between abstract class and interface is one of the most popular question in the interview... between abstract class and interface in java. Abstract class is a class
Abstract class and Interface - Java Magazine
Abstract class and Interface  Dear Sir, Please anyone help me........I wane exact difference between Abstract class and Interface.what... abstract class AbstractExample { public AbstractExample(){ System.out.println
Uses of abstract class & interface - Java Beginners
Uses of abstract class & interface  Dear sir, I'm new to java. I knew the basic concepts of interface and the abstract class. But i dont... my doubt Thank you  Hi Friend, Interface: Java does
where exactly we use interface and where abstract class?
where exactly we use interface and where abstract class?  what is the use of interface over abstract class? and where we should use interface and where abstract class
Real Time Example Interface and Abstract Class - Java Beginners
Real Time Example Interface and Abstract Class  Hi Friends, can u give me Real Time example for interface and abstract class.(With Banking Example
Why does Java provide both abstract class as well as interface
Why does Java provide both abstract class as well as interface  why does java have both abstract class as well as interface? what is the need or importance of having both
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
interface
interface  what the use of interface?   An interface is one which has abstract methods(not defined just declared)and static or non static variables.Any class can implement(inherit)the interface and make use
Interface in java with example
We are going to discuss about Interface in Java. Interface is blueprint of a class. Interface is a collection of abstract methods. Interface has only... all method in interface abstract and public. Multiple inheritance allows
Using Abstract Class
Using Abstract Class          We does not make a object of the abstract class. This class must be inherited. Unlike interface the abstract class may
Interface
and abstract class   interface ShapeInterface{ int l=0,b=0; public...Interface  1.Create an interface names ShapeInterface that has two methods and one constant and an abstract class named ShapeAbstract that has two
Interface
and abstract class   interface ShapeInterface{ int l=0,b=0; public...Interface  1.Create an interface names ShapeInterface that has two methods and one constant and an abstract class named ShapeAbstract that has two
Interface in JSP
the methods are abstract. There is no code associated with an interface. In an interface all the instance methods are public and abstract. Interfaces are always...Interface in JSP      
Interface
for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract... implement(inherit)the interface and make use of the methods(functions
abstract class
abstract class  Can there be an abstract class with no abstract methods
abstract method
abstract method  Can we have abstract class with no abstract methods
interface
interface   what is the use of marking interface
abstract method
abstract method  is final method is in abstract class
Abstract class
Abstract class  what is an Abstract class
Abstract class
Abstract class  Can an abstract class be final
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks