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
In a container there are 5 components. I want to display the all the components names, how will you do that one?
Can we have return statement in finally clause? What will happen?
What is generics in java interview questions?
Difference between character constant and string constant in java ?
How can we make sure main() is the last thread to finish in java program?
Why webdriver is an interface?
How does hashmap work in java ?
describe method overloading
Is java a software?
what is the final keyword denotes in java?
What is the purpose of a default constructor?
What is operator overloading. Is it is supported in java?
Which is faster set or list in java?
What data type is a string?
Write a java program to check if a number is prime or not?