Computer Applications

Which of the following occupies 2 bytes of storage?

  1. 25
  2. AM
  3. 35.2
  4. \\

Values & Data Types Java

2 Likes

Answer

\\

Reason

  1. 25 is an integer literal. In Java, an int occupies 4 bytes, hence it is not correct.
  2. AM represents a string consisting of two characters. Each character occupies 2 bytes, so total memory required is 4 bytes, hence it is not correct.
  3. 35.2 is a double literal. In Java, a double occupies 8 bytes, hence it is not correct.
  4. \\ represents a single character (backslash) using an escape sequence ('\\'). In Java, a char occupies 2 bytes, hence it is correct.

Answered By

1 Like


Related Questions