+ 4

What is the difference between abstract class and interface?

10th Dec 2016, 1:44 PM
Smit Shah
Smit Shah - avatar
5 Antworten
+ 3
An interface has predefined method names that have to be used but does not have anything in them while an abstract is a combination of a normal class and an interface... it will have some methods where code is provided as well as some that are required. You are extend an abstract while you implement an interface. Hope this helps?
10th Dec 2016, 1:56 PM
Matthew
Matthew - avatar
+ 1
An abstract class can contain attributes like normal class do, but interface can only have final ones.
30th Dec 2016, 9:58 PM
merkrafter
0
The essential difference is that a normal class can only inherit one class(abstract or normal class) while it can implement one or more interface.
7th Jan 2017, 10:33 PM
Vincent Hong
Vincent Hong - avatar
0
Another difference is, an abstract class may contain abstract methods or normal methods or both. An interface on the contrary contains only abstract methods.
7th Jan 2017, 10:40 PM
Vincent Hong
Vincent Hong - avatar
0
interface is not class but use to implement the function abstract is a class but cannot be instantiate except by extending that by subclass.
1st Feb 2017, 5:42 PM
Mohsen
Mohsen - avatar