What is the ClassCastException?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the ClassCastException?
Rating:
The ClassCastException is thrown to show an invalid cast. It indicates that the code has attempted to cast an object to a subclass of which it is not an instance. It is also thrown when an attempt is made to add an incompatible object to a collection.
The syntax of the ClassCastException is as follows:
Rating:
Was this information helpful?
Other articles
- What is StringBuilder?
- What is an interface?
- What is a static initializer block?
- Things to practice for Sun test CX310-056.
- What is a try block?