why it is not posssible to create object for interface and abstract class in java -


this question exact duplicate of:

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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -