2

What's the size of Character(char) variable in Java? if it is based on Unicode, what 's the unicode format it is use, UTF-8, or UTF-16?

4 Answers 4

5

The char data type is a single 16-bit Unicode character according to The Java Tutorials.

Sign up to request clarification or add additional context in comments.

1 Comment

Confidently wrong :)
3

Read this:

char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).

P.S. Is this question worth asking? Just 5 seconds of google'ing...

1 Comment

My guess is that it seems the OP asking about the size of Character, not char (though it's not really clear). Though I believe those should be the same.
2

A Java char is 16 bits, and holds a code unit for UTF-16–encoded Unicode code points.

Comments

1

Character.MIN_VALUE is 0 and Character.MAX_VALUE is 65535.

Strings are UTF-16 encoded and can give you 16-bit unsigned char or code points of type int.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.