Abstract and Interface

Abstract and Interface

what is the difference between Abstract and Interface accurateatly?

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,ADS_TO_REPLACE_1 Very Good Question Abstract class is a class which contain one
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
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
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 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
interface
interface   what is the use of marking interface
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
abstract method
abstract method  Can we have abstract class with no abstract methods
abstract class
abstract class  Can there be an abstract class with no abstract methods
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
Abstract class
Abstract class  Can an abstract class be final
Abstract class
Abstract class  what is an Abstract class
abstract method
abstract method  is final method is in abstract class
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
Abstract class,Abstract methods and classes
interface are abstract by default. Abstract method provides the standardization... Abstract methods and classes     ... so many times the word abstract. In java programming language the word abstract
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  why do we need interface in java..if it`s usefull for to obtain multiple inheritance in the sense how it gonna be achieved...and i can...)...the y we need interface...THis is question often i heard from my developer
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
abstract method
abstract method  Can a concrete class have an abstract method
Interface
Interface  Declare an Interface called property containting a method compute price to compute &return the price.The inerface is to be implemented by follwaing two class (1)Bungalow&(2)Flat both the lasses have following
abstract class
abstract class   Explain the concept of abstract class and it?s use with a sample program.   Java Abstract Class An abstract class is a class that is declared by using the abstract keyword. It may or may not have
Abstract class
Abstract class  j   An Abstract class is a base class which... with an abstract keyword. For more information, visit the following links: http://www.roseindia.net/help/java/a/java-abstract-class.shtml http://www.roseindia.net/java
why we use abstract class in java?
why we use abstract class in java?  what is the the purpose of abstract class.Give example when to use abstract and when use interface
abstract class
abstract class  abstract class AbstractClass{ } is possible and compile the class or any compile time error occur tell me the answer Blockquote
abstract class
abstract class  what is abstract class .why we use it or what is the need of this class?   Abstract class is like base class which contains abstract method and cannot instantiated.   Please go through
Abstract class
Abstract class  Calendar cal=Calendar.getInstance() We know that Calendar is an abstract class so it can't be instantiated. So how we can say that cal is an instance of Calendar??? Beginner Question I suppose. Thanks in advace
Abstract class and abstract method
Some key points about abstract methods are as following An abstract modifier identifies abstract classes and methods An abstract methods cannot be private because it defined in the other class. An abstract methods cannot
variables and methods declared in abstract class is abstract or not
variables and methods declared in abstract class is abstract or not  variables and methods declared in abstract class is abstract

Ads