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

What are three advantages of using functions?

765


What is java full form?

727


which one is more efficient int x; 1. if(x==null) 2.if(null==x) state which one either 1 or 2?

10133


Explain the pointers in Java?

813


What is java reflection?

757


What is the main function in java?

801


What is the purpose of the finalize() method?

954


Tell me how many ways are there to initialise an integer with a constant.

879


What does || mean in vectors?

711


Which list is sorted in java?

768


Is empty set an element of empty set?

841


how to write a server program and sending the mails to the server using smtp protocol please help me

1786


How many times finalize method will be invoked? Who invokes finalize() method in java?

790


When arithmeticexception is thrown?

807


Write a program to show whether a graph is a tree or not using adjacency matrix.

851