Java Core Technology Volume 1 basics-First day

Source: Internet
Author: User

Basic data types
Java is the language of a strong data class
There are 8 basic data types, including:
Integer 4 types Int (4 bytes) short (2 bytes) long (8 bytes) byte (1 bytes)
The range and machine-independent lengths of integers in Java are certain, and do not cause integer overflow across platforms

Float type two double float
The length of the double is twice times the length of the float, the double value but the part is used double, at the time of presentation if the writing 3.24 compiler will be considered double type 3.24F is float type
Floating-point numbers have three special values
Positive Infinity (positive integer divided by 0, the result is positive infinity)
Negative infinity
NaN is not a number, that is, non-numeric (0/0 or negative squared) all non-numeric values are not the same if (X==double.nan) is always false
Double does not actually apply with the case of Prohibition rounding, because double a=2.0-1.1 at this time a=0.8999999999999999
The reason is that a double is a binary representation of a binary that is not an exact representation of 1/10 (decimal means 1/3 has a problem) should be used at this time BigDecimal

Char Type a single character (note some common escape characters) is not a valid Java character can be judged by the correlation method in character

Boolean logic to determine false and true

Variable
Java does not differentiate between declarations and definitions of variables, and variables that declare the same data class in Java also support int i,j; This way, but not advocated.

Java Core Technology Volume 1 basics-First day

Related Article

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.