Java four class eight basic data types

Source: Internet
Author: User
Tags float double

Java Four class eight basic data Types 

There are 8 Java basic data types, so just remember. Except that it's all reference type.

Java four class eight basic data types

First class: integer byte short int long
Type II: float float double

Class III: Logical Boolean (it has only two values desirable true false)

Class Fourth: Character Char

Data that can be allocated directly in the stack is the base data type.
Reference data type: is a reference to the data in the stack, but his object is in the heap.
To learn Java you must know where the various data are stored in memory.
A good understanding of memory can help you to analyze the program.

Bytes:
Boolean Boolean 1/8
byte byte type 1
Char character type 21 characters can store a Chinese character
Short Quick-Integer 2
int integer Type 4
float float type (single precision) 4
Long length shaping 8
Double dual precision type (double) 8

The default integer type in Java is type int, and if you want to define float type, add L or L to the value.
The default float is also a double-precision floating point, and if you want to define float type, add F or F to the value.

One byte equals 8 bits, one byte equals 256 digits, and that is 128 to 1271 altogether 256.
KB is Kbytes
Bytes is the meaning of "byte"!
K is the meaning of thousand, because the computer is calculated by binary, 10 1 is exactly 1024
1111111111 (binary) =1024 (decimal)
1Bytes (bytes) =8bit (bits)
An English letter or an Arabic numeral is a character that occupies a byte
A Chinese character is two characters and occupies two bytes.
Generally speaking the size is used bytes, uppercase "B", the network rate is used bit, attention is lowercase "b".
Example: A file has 8MBytes
Example: The rate at which I download files is 256kb/s, which is 2Mbit, which is usually the rate of our broadband Internet connection.

Basic data Type Auto convert Byte->short,char, int, doubleint, floatlong, long floatRemembersmall turn big, big turn little will lose precision!!!

Java four class eight basic data types

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.