Thursday, June 01, 2006

Object casting

When you are performing object casting, the best practice is to incorporate the instanceof operator into your code. First, use instanceof to be sure that the target object is the type you expect; only then should you perform the cast. This ensures that you are never trying to cast an object illegally, and you can be sure to avoid those pesky runtime errors.

0 Comments:

Post a Comment

<< Home