+ 2

what is the difference between abstract classes and interface?

27th Sep 2016, 2:42 PM
Meher jeet
Meher jeet - avatar
7 ответов
+ 4
wrong, zen. you can have abstract class without abstract method. and in jdk 1.8 we can have concrete methods in interface.
27th Sep 2016, 4:55 PM
Nick Silicon
Nick Silicon - avatar
+ 3
An abstract class must have at least one methode which is not implemented and which Will bé overide by the sub-class,so here were are in inheritance.But in an interface all méthod aren't implemented,so the role of the interface is to specify a public API,and all of the class which Will implement the interface must overide all methodes
13th Oct 2016, 2:06 PM
LISANGOLA BONDJALI CHRISTIAN
LISANGOLA BONDJALI CHRISTIAN - avatar
+ 2
An abstract class has at least one abstract method. An interface has only abstract methods.
27th Sep 2016, 3:16 PM
Zen
Zen - avatar
+ 1
Nick , you're quite right about having an abstract class without defining abstract methods. My question is why would you declare a class as abstract in the first place without having to create a minimum of one abstract method? . Remember the main reason why we make classes as abstract is to allow any component that inherits it provide functionality to that specific abstract method.
27th Sep 2016, 10:02 PM
Ousmane Diaw
+ 1
we need to declare abstract keyword for class but dont need to do for an interface
9th Oct 2016, 5:13 AM
Justin Anthony Ross
Justin Anthony Ross - avatar
0
In interface all the methods are abstract method whereas in the abstract class may or may not have the abstract method
23rd Oct 2016, 3:15 AM
s.vigneshwaran
s.vigneshwaran - avatar
- 1
interfaces do not have an implementation, but rather provide you with a contract you must adhere to.
27th Sep 2016, 3:41 PM
Mythos