: MIDRANGE dot COM Mailing List Archive

RE: Thought Question


AddThis Feed Button


>Is it "correct" to use the toString method on the Object, rather than
>casting it to String?

The toString method of the object will return the same value no matter what
kind
of variable is referring to it.

>Which is more efficient?

Casting the object to a String requires a run-time check that the object can
in
fact be cast to a String.  However, the answer to that question is almost
always
"Try it in your environment and see if there's any difference at all".

PC2




Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2007 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact

.

counter