Different outputs

exercise No. 211

Q:

We consider:

Code Output
char value = 10224;
System.out.println(value);

Hint: This is no printing error, the output actually shows up.

int value = 10224;
System.out.println(value);
10224
  1. Why do we get the output ⟰ starting from 10224?

  2. Why do we get two different outputs for the very same value 10224?

    Tip

    Consider the underlying methods starting from System.out examining println(...).

A:

  1. 10224 is the Unicode value representing the ⟰ character.

  2. out is a static member in class System of type PrintStream. Within this class the println(...) method is multiply overloaded. Among these are: