File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes declaring an array using an interface type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "declaring an array using an interface type" Watch "declaring an array using an interface type" New topic
Author

declaring an array using an interface type

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200

One of the best uses of polymorphism in Java is to declare an array using an interface type, then add objects which can be from any class, as long as thay implement the interface type of the array


Is it possible for anyone to give the example codings for the above quoted thing.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724




I didn't try to compile it, but the idea should be clear.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Is it possible for anyone to give the example codings for the above quoted thing.


Megs Maquito
Ranch Hand

Joined: May 18, 2005
Posts: 84


not sure if this is correct though


I'm a Hood Ornament
 
wood burning stoves
 
subject: declaring an array using an interface type