Differentiate between class and interfaces
Class
|
Interface
|
1)doesn’t Supports multiple inheritance
|
1) Supports multiple inheritance
|
2)”extend ” keyword is used to inherit
|
2)”implements ” keyword is used to inherit
|
3) class contain method body
|
3) interface contains abstract method(method without body)
|
4)contains any type of variable
|
4)contains only final variable
|
5)can have constructor
|
5)cannot have constructor
|
6)can have main() method
|
6)cannot have main() method
|
7)syntax Class classname { Variable declaration, Method declaration }
|
7)syntax Inteface Innterfacename { Final Variable declaration, abstract Method declaration }
|