What is the number of bytes used by Java primitive long?

  1. The number of bytes is compiler dependent

  2. 2

  3. 4

  4. 8


Correct Option: D

AI Explanation

To answer this question, we need to understand the size of the Java primitive data type "long."

The Java primitive data type "long" is a 64-bit signed integer. It can hold values ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

In Java, the size of a "long" data type is always 8 bytes. This is because the Java language specification defines "long" as a 64-bit data type, which means it requires 8 bytes of memory to store its value.

Therefore, the correct answer is:

D. 8

Find more quizzes: