This is Type Conversion : type when we use different data types in any variables.
String str = "123.22"; int i = Integer.parseInt(str); float f = Float.parseFloat(str); long l = Long.parseLong(str); double d= Double.parseDouble(str); str = String.valueOf(d); str = String.valueOf(i); str = String.valueOf(f); str = String.valueOf(l);
We also need Type Casting : type, when we use the same data, but in different types. only you impose the type "large" on the "small".
i = (int)f; i = (int)d; i = (int)l; f = (float)d; f = (float)l; l = (long)d;
source share