+ 2

Can anyone tell the difference between abstract class and an Interface in Java??

Both of them contains method without its definition right?

27th Feb 2018, 2:35 AM
Vinayak Hegde
Vinayak Hegde - avatar
4 Answers
+ 4
Interfaces have abstract Methods. For example. public interface Series int getNext(); //return next number in Series void reset(); //restart void setStart (int x); //set starting value
27th Feb 2018, 2:48 AM
Tim Millar
Tim Millar - avatar
+ 2
abstract class can contain both static and non static data members, abstract method but interface contains only static data members and abstract methods
27th Feb 2018, 2:44 AM
vasu
vasu - avatar
+ 2
abstract class allows constructor but interface not allows constructor..
27th Feb 2018, 2:45 AM
vasu
vasu - avatar
+ 1
Thanks vasu
27th Feb 2018, 2:46 AM
Vinayak Hegde
Vinayak Hegde - avatar