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
What is file in java?
What is sortedset in java?
What is difference between printf and scanf?
What is a double vs float?
Why is the singleton pattern considered to be an anti pattern?
What is parsing and its types?
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
What is bubble sort in java?
What are the important features of Java 11 release?
How to connect to a remote database using Applet?
What is the maximum size of array in java?
What is formatted output in java?
What is the use of :: in java?
Which collection is ordered in java?
How do you remove spaces in java?