Demo codes should be as clean as Java code as they are also shipped out with
the product, And customers actually see it to understand how to code that
particular feature of Java so this should be of highest standard,
And should not have any of following:
- Uneccessary casts.
- Unused variables.
- Unused import statements.
- Usuage of Deprecated methods.
See the attached file to see where where all of the above are used
in demo program.
Fixing of the above will:
- Make code look much more clean.
- Easy to understand(No unused variables to fool you around).
- People will use right api's and not the deprecated one's
- Make it run fast(no uneccessary casts) to some extent.
Moreover, there nature is such that removal of them will not(should not) bring
in bugs, so there is minimum risk of introduction of bugs in this fix.