English

Explain the long Data Type with an Example.

Advertisements

Question

Explain the long Data Type with an Example.

Explain
Advertisements

Solution

The long data type is a primitive integer data type in Java that is used to store large whole numbers without decimal points. It is a 64-bit signed integer data type that occupies 8 bytes of memory. It can store values ranging from −9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

Example:

long population = 10000000000L;

In the above example, long specifies the data type, population is the variable name, and 10000000000L is the integer value assigned to the variable. The suffix L indicates a long integer literal.

shaalaa.com
  Is there an error in this question or solution?
Chapter 5: Primitive Values, Wrapper Classes, Types and Casting - EXERCISE [Page 112]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 5 Primitive Values, Wrapper Classes, Types and Casting
EXERCISE | Q 4. (e) | Page 112
Advertisements
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×