Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One thing great about Java is that it is unicode based. That means, you can use characters from writing systems that are not english alphabets (e.g. Chinese or math symbols), not just in data strings, but in function and variable names too.</p> <p>Here's a example code using unicode characters in class names and variable names.</p> <pre><code>class 方 { String 北 = "north"; double π = 3.14159; } class UnicodeTest { public static void main(String[] arg) { 方 x1 = new 方(); System.out.println( x1.北 ); System.out.println( x1.π ); } } </code></pre> <p>Java was created around the time when the Unicode standard had values defined for a much smaller set of characters. Back then it was felt that 16-bits would be more than enough to encode all the characters that would ever be needed. With that in mind Java was designed to use UTF-16. In fact, the char data type was originally used to be able to represent a 16-bit Unicode code point. </p> <p><strong>The UTF-8 charset is specified by RFC 2279;</strong> </p> <p><strong>The UTF-16 charsets are specified by RFC 2781</strong></p> <p>The UTF-16 charsets use sixteen-bit quantities and are therefore sensitive to byte order. In these encodings the byte order of a stream may be indicated by an initial byte-order mark represented by the Unicode character '\uFEFF'. Byte-order marks are handled as follows:</p> <pre><code>When decoding, the UTF-16BE and UTF-16LE charsets ignore byte-order marks; when encoding, they do not write byte-order marks. When decoding, the UTF-16 charset interprets a byte-order mark to indicate the byte order of the stream but defaults to big-endian if there is no byte-order mark; when encoding, it uses big-endian byte order and writes a big-endian byte-order mark. </code></pre> <p><a href="http://www.koders.com/java/fid89844CCA0616F27AB0678C8FE1C481E084DB39FC.aspx?s=MRU" rel="nofollow">Also see this</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload