This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "inheritance" Watch "inheritance" New topic
Author

inheritance

duole
Greenhorn

Joined: Jul 01, 2002
Posts: 7
suppose T is a class and U is T's subclass, is the statement below legal? How does it work? Thank you.
T t = new U(1,2);
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
It's legal, provided that U really has a constructor that takes two parameters of type int
[ August 29, 2002: Message edited by: Ron Newman ]

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
duole,
Welcome to Javaranch
We'd like you to read the Javaranch Naming Policy and change your publicly displayed name (change it here) to comply with our unique rule. Thank you.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
 
subject: inheritance
 
Similar Threads
Generic Singleton Class
Where are U from?
instanceof
Word Games
NX:Exceptions