Home > Java > JavaBase > body text

The difference between java long int

angryTom
Release: 2019-11-16 17:12:33
Original
10490 people have browsed it

The difference between java long int

The difference between long int in java

Both long and int in java are integers, why do they need to be subdivided? What about the two data types long and int? This is because they represent different sizes. The specific differences are as follows:

1. Difference 1

16-bit system: long is 4 bytes, int is 2 bytes

32-bit system : long is 4 bytes, int is 4 bytes

64-bit system: long is 8 bytes, int is 4 bytes

2. Difference 2

The difference between long and int is that their occupancy lengths are different. Long is 64 bits, while int is 32 bits.

3, Difference 3

int: 32-bit integer -2,147,483,648——2,147,483,647, generally integers are enough

long: 64-bit integer -9,223,372,036,854,775,808——9,223,372,036,854,775,807, generally not needed

Supplement :

Java data types are divided into two types:

1. Basic types: long, int, byte, float, double, char

2. Object type (Class): Long, Integer, Byte, Float, Double, Char, String, all other classes provided by java or created by yourself.

Long is also called the packaging class of long. The same goes for Byte and Float. Generally, the first letter of the name of the package class is the capital of the numerical name.

php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!

The above is the detailed content of The difference between java long int. For more information, please follow other related articles on 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!