What is the difference between Abstract Class and Interface

Answer Posted / ranjith

Abstract class:its an incomplete class,containg default
implementation for its sub classes. it contains both
abstract and concrete methids. access specifier
public,private and protected can be used for methods and
variable declaration.atleast on abstract method should be
present in the class. then class extending the abstract
class should override all the abstract methods or the
extended class should be abstract. only one abstract class
can be extended at a time..it contains keyword abstract.it
supports tight coupling.

Interface: all the methods and variable declarations in
interface are either public or abstract.private and
protected acces specifer can be mentioned. it provides
default implementaion for the class that implement it.none
of the methods conatain any method body. the class that
implements should provide implementation for all the
methods in the interface. it provies loose coupling(inter
dependency between the class and interface is less)

Is This Answer Correct ?    23 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Implement a stack with push (), pop() and min() in O(1) time.

638


What is the difference between compare and compareto in java?

491


Is string a wrapper class?

519


Can I declare class as static or private?

546


What are the classes of java?

543






Explain about field hiding in java?

528


Does google use java?

543


What is java virtual machine? Explain

571


What is the difference between a static and a non-static inner class in java programming?

533


What is final access modifier in java?

594


Differentiate between static and non-static methods in java.

571


Which language is java?

547


Can constructor be inherited?

579


What are the different tags provided in jstl?

553


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

1826