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 a vararg?
Which number is denoted by leading 0x or 0x in java?
Can we sort set in java?
Why is java called the platform independent programming language?
How can you handle java exceptions?
Is java a pure object oriented language?
What is use of static method?
How is abstraction implemented in java ?
Difference between string s= new string (); and string s = "abv";?
What restrictions are placed on method overloading?
How does java pattern compile work?
Explain wrapper classes in java?
What’s the difference between unit, integration and functional testing?
Which is the class in java?
Why string objects are immutable in java?