1, 3.4 bit double type, float = 3.4 is not correct, double double bit, 8 bytes 64 bits, float bit 4 bytes Single Precision 32 bits, so the narrowing conversion will make the precision loss, correctly written as float = 3.4f
int is 32 bits, long bit 64 bit, short is 16 bits
Long a = 1L;
Short B =1
2. The Math class provides three methods related to rounding: Ceil,floor,round, these methods correspond to the meanings of their English names, for example: the English meaning of Ceil is the ceiling, which means rounding up, The result of Math.ceil (11.3) is 12,math.ceil (-11.6), the result of which is -11;floor is the floor, the method represents a downward rounding, and the result of Math.floor (11.6) is 11,math.floor (-11.4) The result-12; The most difficult to master is the round method, he said "rounding", the algorithm is Math.floor (x+0.5), the original number plus 0.5 and then rounded down, so, math.round (11.5) The result is 12,math.round (- 11.5) The result is -11.
3, Java's% to find the modulus of redundancy,/take positive, jdk1.7 and above switch type can function string, but long type is still not
, the constructor cannot be overridden, but can be overloaded
This article is from the "AutoComplete" blog, make sure to keep this source http://7129486.blog.51cto.com/7119486/1952407
Basic knowledge of Java related interviews