Total Pageviews

Monday, November 29, 2010

Difference between a Java interface and a Java abstract class?

Hello every one,
There are few points that I think distinguishes Java interface from a Java Abstract Class. have a look -
1. 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. A Java 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.

30 comments:

  1. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The Struts, Spring, Hibernate are the advanced level of programming language which are most widely used.
    spring training in chennai | spring hibernate training in chennai

    ReplyDelete
  2. I have read your blog its very attractive and impressive. I like it your blog.


    JavaEE Training in Chennai JavaEE Training in Chennai

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Java 8 Training in Chennai

    ReplyDelete
  3. Java Training Institutes Java Training Institutes
    Java Spring Hibernate Training Institutes in Chennai J2EE Training Institutes in Chennai J2EE Training Institutes in Chennai Core Java Training Institutes in Chennai Core Java Training Institutes in Chennai

    Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai

    ReplyDelete
  4. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Web Designing Course in Chennai | web designing training in chennai

    ReplyDelete
  5. Wonderful post. I learned so many things from your blog.. keep posting.. Dot Net Training Institute in Chennai | Dot Net Training Institute in Velachery.

    ReplyDelete
  6. Your blog was so awesome., you explained clearly each and every topic in Java Technology. Thanks for sharing such a nice blog.. HP LR Training in Chennai | ALM Training in Chennai | UFT Training in Chennai

    ReplyDelete
  7. Hi, am a big follower of your blog. I am really happy to found such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post. keep update your blog.
    Android Training Institute in Chennai | IOS Training in Chennai | Online Android Training in Velachery

    ReplyDelete
  8. I like the post format as you create user engagement in the complete article. It seems round up of all published posts. Thanks for gauging the informative posts.
    cara menggugurkan kandungan

    ReplyDelete
  9. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.

    sas training in bangalore

    ReplyDelete
  10. Such a great articles in my carrier, It's wonderful commands like easiest understand words of knowledge in information's.
    BE/B.Tech Project Center in Chennai | BE/B.Tech Project Center in Velachery

    ReplyDelete
  11. Thanks a lot! You made a new blog entry to answer my question.I really appreciate your time and effort.VLSI Project Center in Chennai | VLSI Project Center in Velachery

    ReplyDelete
  12. It is most knowledgeable information like this.I will read this article it is very easy to learn this blog.
    Best Selenium Training Institute in Chennai | Selenium Training Institute in Velachery

    ReplyDelete
  13. You have done a great job, really the concept of Java was superb, its very interesting and easy to understand also.. Keep updating such a nice blog..
    Automation Anywhere Training in Chennai | RPA Training Institute in Chennai | UI Path Training Institute in Chennai | Blue Prism Training Institute in Chennai

    ReplyDelete
  14. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    Hadoop Training Institute In chennai

    ReplyDelete
  15. Great post.Thanks for one marvelous posting! I enjoyed reading it;The information was very useful.Keep the good work going on!!
    Citrix Exams in Chennai | Xenapp exam center in Chennai

    ReplyDelete
  16. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site...Embedded Project Center in Chennai | Embedded Project Center in Velachery

    ReplyDelete
  17. Excellent ! I am truly impressed that there is so much about this subject that has been revealed and you did it so nicely.
    Cisco Certifications Coaching Center in Chennai | Best Cisco Courses in Chromepet

    ReplyDelete
  18. Wow Pretty article..Thanks for sharing your interesting and useful information with us..
    ISTQB Certifications Course in Chennai | QA Testing in Medavakkam

    ReplyDelete