Unicode System in Java — Java Technical Interview Questions & Answers

Unicode System in Java

Unicode System in Java

  • Unicode means Java can store Hindi, English, and many other scripts, not only A–Z. That matters for real apps in India.
  • A char is based on Unicode. You can also write '\u0905' for अ. Everyday text usually sits in a String, not a single char.
  • One char is not always one visible symbol. Some symbols need more than one code unit. Don’t treat every letter as exactly one char.
  • Let's take this on the board with one tiny Main class — no extra files. Unicode System in Java — output: अ. \u0905 is Unicode for अ — Java char can store Hindi, not only English. Start from main, go line by line, and stop at each print. That output is the proof for Unicode System.

Technical Interview Tip: Say: Java uses Unicode, so Hindi text is normal, not a hack.

Code Examples for Unicode System in Java

Example

public class Main {
  public static void main(String[] args) {
    char hindi = '\u0905'; // अ
    System.out.println(hindi);
  }
}

Unicode System in Java — output: अ. \u0905 is Unicode for अ — Java char can store Hindi, not only English.

How to Explain Unicode System in Java to an Interviewer

Why does Java use Unicode?

Many languages Hindi + English OK

Where do you store a sentence?

String Not one char