Home | Login | Blog | Forum | Download | RSS Feed | Ajax | Hello-World | J2EE | BPM | EJB | FileNet | Hibernate | ORM | IBM | ILOG | Interview | FAQs |

Java | Apache | JVM | Others | BRMS | Oracle | Pega | SOA | Sun-Certification | Web-Service | websphere | XML |
 

JAVA DEVELOPER SITE - COMPLETE JAVA TUTORIALS

Difference Between Interface and Abstract Class


Share
 
 

Useful Java Links


       


Abstract Class

§  Abstract class is a class which can not be instantiated, which is declared by abstract keyword.

§  Abstract class may or may not contain abstract methods. Abstract method is a method which is declared without any implementation. Abstract methods cannot be marked as final or abstract private. Abstract modifier can never be combined with static modifier.

§  Abstract class  contains one or more concrete methods and  instance variables. Abstract class can have private or protected methods and variables.

§  Abstract class provides tight coupling.

§  If a class includes abstract methods, the class itself must be declared abstract.

§  Abstract class is subclassed. Subclass provides the implementation for all the abstract methods in the parent class. If it does not provide implementations for all the abstract methods it must be declared as abstract.

§  Abstract class may have static methods and static variables. We can access this static members using class reference i.e. AbstractClassDemo.staticSample();

§  Can only subclass one abstract class. Single inheritance is achieved through the abstract class.

§  Abstract class can extend only one superclass but it can implement more than one interface.

§  The general form of abstract class is

____________________________________________

public abstract class Programmer {

private int i=0

public String str=”hello”;

public abstract void program();

                        public int getdata(){//code}

            }

____________________________________________ 

 

Interface :

 

§  Interface are pure abstract class. Interface are just like classes, but doesn't contain instance variables and methods are declared without any body.

§  Java interface are designed to support dynamic method resolution at runtime.

§   All the methods in the interface are by default public abstract.

§   Interface contains constants, all variable are by default public static final.

§   The class which is implementing the interface must provide the actual implementation.

§  A class can implement more than one interface. Multiple inheritance is achieved through the interface.

§  Interface can extend more than one interface.

§  The general form of interface is

                        interface name{

                        return-type method-name(parameter-list);

                        type final-varname= value;

            }

 

            Here name is interface name. Note that  method which are declared don't have method body.




Download Latest Java/J2EE eBooks, SCJP Dumps, SCWCD Dumps, Pega Tutorial, IBM WebSphere BPM tutorials and many more


If you need any urgent assistance on difference-between-a-java-interface-and-a-java-abstract-class, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.

You can also subscribe to our newsletters on difference-between-a-java-interface-and-a-java-abstract-class, to receive updates on difference-between-a-java-interface-and-a-java-abstract-class,via email.Enter you email below:

Enter your email address:

Delivered by FeedBurner



Keyword Tags: difference-between-a-java-interface-and-a-java-abstract-class tutorial,difference-between-a-java-interface-and-a-java-abstract-class in java,Concepts of difference-between-a-java-interface-and-a-java-abstract-class,Java,J2EE,Interview Questions,difference-between-a-java-interface-and-a-java-abstract-class Examples


Comments:


Post Your Comment:

*

Yes, I would like to recieve email notifications on my reply.

Popular Posts:

 
Popular Downloads

SCJP 1.6 Dumps
JSP Interview Questions
Struts Interview Questions
Hibernate Interview Questions
SCWCD Dumps
SCBCD Dumps

Java/J2EE Tutorial
JMS Tutorials
seam richfaces tutorial
richfaces live demo
jquery example demo
JQuery Tutorial and Source Code
JSF Tutorial
XSL Tutorial
J2EE JMS
CORBA Applications
Java CERTIFICATION
SCJP 1.5
SCJP 1.6
SCWCD 1.5
SCBCD
Mis
Ajax autosuggest autocomplete from database
Struts forms and validation with webflow
Java Apache POI Examples
JDBC Tutorial
Oracle 9i & 10g
MYSQL Tutorial
php Tutorial
JQuery Examples
Upload Java File
JAXB Examples
PL-SQL Tutorial
Dojo AJAX
EJB Examples
Java IDE
Eclipse
NetBeans
IBM Rational Weblogic Workshop
Downloads
SCJP 1.6 Dumps
SCJP 1.5 DUMP
SCJP Material
SCWCD
Java Security
SCBCD Dumps
External Links
SUN Java
JOracle
IBM
PHP Certification
Technical Interview Questions
Amazon Interview Questions
Google Interview Questions
Microsoft Interview Questions
IBM Interview Questions
Yahoo Interview Questions
All Tutorials
php mysql tutorial
SCJP 1.5/1.6
SCWCD 1.5/1.6
Polymorphism
Thread Tutorial
Generics & Exceptions
Spring Struts Hibernate
Java Collections
MAP
SET
LIST
VECTOR
Advanced Java
Stateless Session Bean
Introduction to EJB
Stateful Session Bean
Java Design Patterns
HOME | FORUM | ABOUT | BLOGS | CONTACT-US