मराठी

Differentiate between the following: int and long

Advertisements

प्रश्न

Differentiate between the following:

int and long

फरक स्पष्ट करा
Advertisements

उत्तर

int

long

1. The int data type is used to store integer values of a smaller range in Java.

1. The long data type is used to store integer values of a larger range in Java.

2. The int data type occupies 4 bytes (32 bits) of memory.

2. The long data type occupies 8 bytes (64 bits) of memory.

3. The range of int is −2,147,483,648 to 2,147,483,647.

3. The range of long is −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

4. The int data type is suitable for storing integer values within the 32-bit range.

4. The long data type is suitable for storing large integer values beyond the range of int.

5. Integer literals within the int range are treated as int by default.

5. A long integer literal can be specified using the suffix L or l.

6. Example: int a = 1000;

6. Example: long a = 10000000000L;

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 6: Variables and Expressions - EXERCISE [पृष्ठ १३२]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
पाठ 6 Variables and Expressions
EXERCISE | Q 30. (c) | पृष्ठ १३२
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×