Archived

This topic is now archived and is closed to further replies.

King of Men

Typecasting in Java

Recommended Posts

Does this consume any resources? In principle, you should just be telling the compiler that the pointer is to be treated as Class X, instead of Object. At runtime, after all, what actually gets stored is just a list of ints, floats, and whatnot. But maybe there are issues I''m not aware of? In short, what are the pros and cons of typecasting? To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.

Share this post


Link to post
Share on other sites
Yes, there is a cost to doing typecasts in Java.

For more specific examples you might want to read this article. It''s a little old, but the basics haven''t changed.

Share this post


Link to post
Share on other sites