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.

Enter your email address:

Delivered by FeedBurner

Sandeep Joshi
Mathematics, Technology and Programming are my passion. I am a part of Java Ecosystem and through this blog, I contribute to it. I am here to blog about my interests, views and experiences.
I am on Google+ and Facebook.
I feel proud to be listed as a "National Memory Record Holder" in the Limca Book of Records, 2009 and have attempted for an International Memory record in the Guiness Book of Records. I can remember the value of PI upto 10,000 digits after the decimal (3.1415.....). You can contact me on javagenious.com(At)gmal.com ; I would like to hear from you :)