1(ii)
Which of the following occupies 2 bytes of storage?
- (a)25
- (b)AM
- (c)35.2
- (d)\\
Show SolutionHide Solution↓
\\
Reason —
- 25 is an integer literal. In Java, an
intoccupies 4 bytes, hence it is not correct. - 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.
- 35.2 is a double literal. In Java, a double occupies 8 bytes, hence it is not correct.
- \\ represents a single character (backslash) using an escape sequence ('\\'). In Java, a char occupies 2 bytes, hence it is correct.