Basic knowledge of Java related interviews

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.