How to type cast one class to another in Java

Tutorials Shared by the Internet Community

Advertisements


Synopsis

Type casting in Java is used to cast one class or interface to another, if they are from same type hierarchy. Type casting is an important concept to

Statistics

  • Total Hits - 26924

  • Total Votes - 139 votes

  • Vote Up - 67 votes

  • Vote Down - 72 votes

  • Domain - javarevisited.blogspot.com

  • Category - JAVA/Core JAVA

  • Submitted By - Javin Paul

  • Submitted on - 2013-12-22 01:02:28

Description

Type casting in Java is used to cast one class or interface to another, if they are from same type hierarchy. Type casting is an important concept to understand, not just to avoid ClassCastException but also take full advantage of interfaces in Java, which is key to define flexible type hierarchy. ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements