File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Constructors" Watch "Constructors" New topic
Author

Constructors

Manju KT
Greenhorn

Joined: Jan 16, 2008
Posts: 7
Can anybody tell me whether we can create a instance of type subclass using superclass constructor?
Charmy Madhvani
Ranch Hand

Joined: Dec 26, 2007
Posts: 59
You mean to say:
Child c=new Parent();

No..This is not valid in Java.
You can only have a Parent type reference to a child type object but not vice versa.


SCJP 5.0<br />SCWCD 5.0
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Manju KT",
Please check your private messages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructors