File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the difference between Abstrace Class and Interface

 
Dudekonda Sudhakara
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public abstract class A {

public void add(int a, int b);
}


//interface

public interface B{
public void add(int a, int b);
}

My question is java provides abstract class as well as interface, then what is the main difference b/w these two.
It's MNC interview question.

I gave him answers like elimination duplicate code, access restriction but still he was expecting something else.

please provide me an answer.

Thanks in advance.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

The question "what is the difference between an abstract class and an interface" is asked regularly here. We have a FAQ page about it: Interface vs Abstract Class
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic