Java
Programming and Technical
What is the difference between an
Abstract class and Interface?
Read Solution (Total 7)
-
- Abstract class can contain both abstract methods and concrete methods whereas in interfaces it contains only abstract things
- 9 years agoHelpfull: Yes(2) No(1)
- Abstract Class Hides 70% but Interface Hides 100% abstaction in java programming
- 10 years agoHelpfull: Yes(1) No(2)
- Abstract class can have constructors but the interface does not have constructors
- 9 years agoHelpfull: Yes(0) No(0)
- Abstract Interface
1.Abstract having both abstract methods 1.Interface have only abstract methods
and Concrete (implementation ) methods.
2.No need to implement all abstract methods 2.Must and should be implement all methods in it's
in it's sub classes. sub classes. - 9 years agoHelpfull: Yes(0) No(0)
- we use the abstract class by extend keyword it means we include that whole class in our derived class just like a copy concept but in case of interface we implement it. so whenever we perform any changes in declaration part of abstract class then at each place we have to modify it but in case of interface if we change in declaration of interface then it will automatically update by not producing any error.
- 9 years agoHelpfull: Yes(0) No(0)
- When we don't know about implementation just we have required specification then we will go for Inteface . When we need to partial implementation we will go for Abstract class.
- 9 years agoHelpfull: Yes(0) No(0)
- 1. Abstract class is used when partial information is known about its implementation. But interfaces are used when we do not know anything about its implementation and only some requirement specifications have been given to us.
2. Interfaces are purely 100% abstract as it contains only abstract methods . But abstract class are not purely 100 % abstract as within abstract class we have concrete as well as abstract methods.
3. In interfaces it is mandatory that all methods should be public and variables should be public final static. However there are no such restrictions in Abstract classes
- 9 years agoHelpfull: Yes(0) No(0)
Java Other Question