volume_mute

What is the difference between int and long in Java?

publish date2020/09/16 01:07:00 GMT+10

volume_mute
int is a data type to represent number, but long is used for string
long is data type which is no longer used in java where it was replaced by int
int is 32-bit width where long is 64-bit width
The decimal point of long is 64-bit where int decimal point is 32-bit

Correct Answer

int is 32-bit width where long is 64-bit width

Explanation

The basic difference between the type int and long is of their width where int is 32 bit, and long is 64 bits. ... In Java, the range of type int is from –2,147,483,648 to 2,147,483,647 whereas, the range of type long is from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 which is very much greater than type int.

Reference

techdifferences.com


Quizzes you can take where this question appears