Java starts from zero the next day

Source: Internet
Author: User

April 28, 2015 night, Zhuhai. Clear

basic data types for Java

Integer (integer), floating-point (float), Boolean (Boolean), character-type (char)

1. Integral type (integer)

Java's most basic data type, using int to represent a range that has a short long int byte

1.1 Decimal (most common and most commonly used in life)

int i = 100; int j=-120;

1.2 Octal (the binary rule is full 8 in 1, including 0-7 of 8 digits.) Adding a 0 to an integer is an octal number)

int i = 08; int j=-12;

1.3 Hex (the binary rule is full 16 in 1, including 0-9 and a-f components. Integer preceded by a 0x is hexadecimal number)

int i =0x05; int j = -0XFFAA;

Range of integer values

Type -bit Bytes Range of values
Byte 8 1 -27 ~ 27-1
Short 16 2 -215 ~ 215-1
Int 32 4 -231 ~ 231-1
Long 64 8 -263 ~ 263-1

Note: The integer data type pattern is int

2 float type (float)

Single-precision floating-point type

float F = 11.21F; Float F1 = -17.15f

Double-precision floating-point type

Double d = 11.11223D; double-17.15555;

Value access for floating-point type

Type -bit Bytes Range of values
Float 32 4 ±40282347e+38f
Double 64 8 ±1.79769313486231570e+308

Note: There is no letter at the end of the floating-point type, and the data is a double-precision floating point.

3. Character type (char)

A character type is a type of data that is a character. Char type represents a character, 16 bits, two characters, for example ' a ' person ' and so on

char c = ' C '; Represents a character

char c = ' \u005e ';//Represents a Unicode code

Char c =565;//represents an integer

Char The underlying implementation is also a numeric type, so you can convert to int type

4. Boolean type (Boolean)

A Boolean is a type of data that is judged. True and false, use True and false in Java to denote true and false

Boolean b =true;

Boolean b =false;

I believe you have looked at me this basic data type can have a little awareness, for the content of the back to continue efforts! Good night. A rookie greeting.

Java starts from zero the next 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.