Home > Java > javaTutorial > Basic data types in JAVA

Basic data types in JAVA

高洛峰
Release: 2017-02-03 17:14:13
Original
1721 people have browsed it

byte: The smallest data type in java. 1 byte/8 bits. -128 (2^7)~127 (2^7-1), default value 0.

short: Short integer, 2 bytes/16 bits, value range -32768 (--2^15)~32767 (2^15-1), default value 0

int: Integer type, 4 bytes/32 bits, value range -2147483648 (-2^31) ~ 2147483647 (2^31-1), default value 0

long: Long integer type, 8 words Section/64 bits, -2^63 (-2^63)~2^63-1 (2^63-1), default value 0L

float: Floating point type, 4 bytes/32 bits , used to store numbers with decimal points (the difference from double is that the float type has only 6 to 7 valid decimal digits), default value 0

double: Double precision floating point type, 8 bytes/64 bits, default Value 0

char: Character type, single character, 2 bytes/16 bits, 0 ('\u0000') ~ 65535 ('\uffff'), default value is empty

boolean: Boolean type, 1 byte, judge true or false (only two values, true, false), default value false

Small capacity --------------- ----------------> Large capacity

byte,short,char << int << long << float << double

byte << short

byte and char, short and char will not have implicit conversion, only forced type conversion can be performed between each other.

The above is the entire content of this article. I hope that the content of this article can bring some help to everyone's study or work. I also hope to support the PHP Chinese website!

For more articles related to basic data types in JAVA, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template