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 query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "query" Watch "query" New topic
Author

query

ajay Kumar Rana
Greenhorn

Joined: Feb 04, 2008
Posts: 2
Can we pass a reference of subclass to a method which has parameter of superclass type.
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Welcome to the Java Ranch,

Can we pass a reference of subclass to a method which has parameter of superclass type.


Yes. In fact it is generally good to use a more abstract class or even an interface which is more abstract as parameters because this makes your method more general.

Kaydell
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: query