Hi stuart harper
Welcome to Ranch
This Program is to understand the primitive types, type cast, which type can cast implicitly, which type need explicit casting.
1:
int can be placed to double, which is implicit cast.
2:
double no need of explaintion,
y = (int) d, which truncates the fractions
3:
z=(int)3.14, here 3.14 means double constant(so next line is z=3.14f which tells float constant), so if you explicitly cast to int, which make z= 3.00
4:
defining constant for long datatype
5:
byte constant should have value less then 255
if you add 2 byte variable result will be in int so we need explicit cast to byte(you may loose data)
But i am not able to understand what is this
int name = "rich";
because we can not assign String constant to int, and its not char constant also.