Type casting is when you assign a value of one primitive data type to another type.
B b = new B(); A a = (A)b;
- There must be some relation between A and B, it can be parent and child relationship.
- Type of (A)b must be the A or derived object of A.
String s = new String("Durga"); Object o = (Object)s;