Common data types: integer, floating point
byte 1(2^8) -128 ~ +127 bytes
short 2(2^ 16) -32768 ~ +32767 Short integer type
int 4(2^32) Integer type
long 8(2^64) Long integer type
float 4 different digits of significant digits 7 single precision floating point numbers
double 8 different digits of significant digits 15 double precision floating point numbers
For the first question: You can type the following code:
p>int a = 12;
byte b = a;
System.out.println(b);
Error: Type mismatch: cannot convert from int to byte: Type matching error
Failed to convert int to byte
Second question:
floate f=12.4; //Error when converting double to float
Maybe you wrote it wrong: it should be: float f=12.4f;
Usually f should be added when defining floating point data
All decimals For numbers, it is double type data by default
For the third question:
Double precision: 64 bits, its range is: -
1.79769313486231570E+ 308~~1.79769313486231570E+308 The default value is: 0.0d
As for why no error is reported, it may be due to the computing performance of the computer itself, and it can now be displayed using scientific notation, specifically how many digits there are. How much is it, I can’t solve it