- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between int and long
In this post, we will understand the difference between ‘int’ and ‘long’ types.
int
It is a datatype.
It has 32-bits.
In terms of bytes, it takes up 4 bytes.
In Java, it is between the range –2,147,483,648 to 2,147,483,647.
It is also used as a keyword to declare variable of type integer.
In comparison to memory required to store ‘long’ variables, it takes up less memory space.
long
It is a data type.
It takes 64-bits.
In terms of bytes, it takes 8 bytes.
In Java, its range is between –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
It can also be used as a keyword to declare a variable of type ‘long’.
Its memory space requirement is more in comparison to ‘int’.
Advertisements