This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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