KnowledgeBoat Logo

Computer Applications

The size of '\n' is:

  1. 2 bytes
  2. 4 bytes
  3. 8 bytes
  4. 16 bytes

Values & Data Types Java

ICSE Sp 2025

11 Likes

Answer

2 bytes

Reason ā€” In Java, \n (newline character) is a character literal. All character literals in Java, including escape sequences like \n, are stored as char data type, which occupies 2 bytes (16 bits) in memory.

Answered By

6 Likes


Related Questions