Something like ...
java.util.Iterator it = results.iterator();
String resultsString = (String)it.next();
We are making explicit that the Object should be cast to String
-----Original Message-----
From: Emmanuel Eze [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 10:43 AM
To: JDJList
Subject: [jdjlist] RE: [jdjlist] RE: [jdjlist] casting
can u give an example of explicit cast?
-----Original Message-----
From: RAMESH VISHNUVARDHAN [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 12:18 PM
To: JDJList
Subject: [jdjlist] RE: [jdjlist] casting
When you assign a variable of parent class type to an object of subclass,
the implicit casting occurs.
Example:
java.util.Date parentDate = null;
parentDate = new java.sql.Date(Calendar.getInstance().getTime().getTime());
The above code is valid. Here we no need to do explicit casting
.
Regards,
Vishnu
-----Original Message-----
From: Emmanuel Eze
To: JDJList
Sent: 5/7/02 11:08 AM
Subject: [jdjlist] casting
This cast thing is beginning to get me confused. if I cannot cast a
java.util.Date to a java.sql.Date since the util.Date is the ancestor
class,
can I cast a java.sql.Date to java.util.Date. I really wish to
understand
the nitty gritty of casting.
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
This e-mail and any attachment is for authorised use by the intended recipient(s)
only. It may contain proprietary material, confidential information and/or be subject
to legal privilege. It should not be copied, disclosed to, retained or used by, any
other party. If you are not an intended recipient then please promptly delete this
e-mail and any attachment and all copies and inform the sender. Thank you.
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm