What is type casting in Java language?

: 885
Paper : Java FAQ (Frequently Asked Questions and answers) for freshers | Platform : Object-oriented programming Language | Category : Programming FAQs

Typecasting means assigning an object of the superclass to an inherited class or vice-versa. There are two types of typecasting:

  • upcasting: It assigns the object of the subclass to the superclass variable. 
  • downcasting: It assigns the object of the superclass to the subclass variable.