What is the difference between abstract class and interface?

Answer Posted / srikanth reddy

1. Abstract classes may have some executable methods and
methods left unimplemented. Interfaces contain no
implementation code.
2. An class can implement any number of interfaces, but
subclass at most one abstract class.
3. An abstract class can have nonabstract methods. All
methods of an interface are
abstract.
4. An abstract class can have instance variables. An
interface cannot.
5. An abstract class can define constructor. An interface
cannot.
6. An abstract class can have any visibility: public,
protected, private or none
(package). An interface's visibility must be public or none
(package).
7. An abstract class inherits from Object and includes
methods such as clone() and
equals().

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is file in java?

784


What is sortedset in java?

781


What is difference between printf and scanf?

733


What is a double vs float?

745


Why is the singleton pattern considered to be an anti pattern?

669


What is parsing and its types?

782


how we can use debug in myeclipse 6.0 in order solve the problems that exist in our program when there are 900 to 1000 pages in a web application

1881


What is bubble sort in java?

849


What are the important features of Java 11 release?

789


How to connect to a remote database using Applet?

2250


What is the maximum size of array in java?

737


What is formatted output in java?

722


What is the use of :: in java?

777


Which collection is ordered in java?

739


How do you remove spaces in java?

755