āœļø Explanatory Question

Is a string of one character the same as a character literal?

šŸ‘ 16 Views
šŸ“˜ Detailed Answer
🟢 Easy
šŸ’”

Answer with Explanation

No, they are different.

  • 'a' → Character literal (char)
  • "a" → String

šŸ‘‰ Key difference:

  • Character → single symbol
  • String → sequence of characters

Even if a string has one character, it is still a string, not a char.