java - why methods return a value (except void()) -


this statement oracledoc can't able understand statement please explain example. " can use interface names return types. in case, object returned must implement specified interface "

here's method return type interface (java.util.list). since can't instantiate interface, method must return instance (object) of class implements list interface (java.util.arraylist in example).

public list foo () {     return new arraylist (); } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -