why it is not posssible to create object for interface and abstract class in java -
this question exact duplicate of:
- instantiate interface [duplicate] 4 answers
i know can't create object interface , abstract class. doubt why? why can't create object interface , abstract class? example
class demo{   } demo demo = new demo();//it possible but
interface demo{  }  demo demo = new demo();// not possible why? 
an object in java contains data (class members) , set of operations (methods). these operations performed on data stored object.
now both interface , abstract class don't provide concrete implementation of operations, performed on object data. interface , abstract classes in java used define/declare contract object. contract of operations later fulfilled concrete/complete classes.
so these incomplete objects of no use in application. java not allow creating instance of interface or abstract classes.
Comments
Post a Comment