The code below is resulted to the compiler error in java
float variable = 123.4
And it is because of the fact that the default for the floating point literal value is Double data type. So, we should cast the literal value to the float in advance or declare the variable as double in order to solve this issue. As we know the default for the integer literal value is Integer data type. However, there is no compiler error when we declare a Byte variable like the example below
byte variable = 123
I want to know why we do not have to cast 123 to Byte data type if the default for integral literal value is integer.