java core technology to read 10 (a)

The relationship between Unicode String class coding and JAVA basic variables char

unicode is coded in different languages in order to solve the problem diversification and the development of a unified national coding standard. In unidecode, the use of code points , i.e., the prefix U +, suffix representing the character code value of hexadecimal number corresponding to a combination of, for example, U + 0041 representing the character "A". The standard is 16 hexadecimal to write the code point may be divided into 17 levels, the first level code is called a multi-language basic level, from U + 0000 to U + 00FFFF, the remaining level of secondary character.

UTF-16 encoding is a different coding lengths represent all Unicode code points to address 16 char type variable encoding can not describe all unicode characters. In which multi-level language, each character is represented by 16 bits, which is referred to as code elements. Most of the characters using a code unit on the line, while the secondary characters need to use a pair of code units.

Official UTF-16 encoding of a variable code units java char type described, but there is a sequence of type String char type value, string length () / charAt returns the position of the code unit and the number of code units. All length and some special characters length is 2, officially because it has two units of code, but the code is only a point. 

JAVA String class can not be modified

String class String can not be modified, similar to the operation pointer, pointer points to a heap memory , so that the string can be easily shared memory, increase efficiency, and java will automatically make the recovery of the missing character memory.

If you want to modify the string, and the need subString + splicing to generate a new number string.

== can not be used to compare two strings are the same, and because of the java == like C ++ does not overload the same equality is detected, instead of using a pointer mode. To compare the need to use compareTo () method

JAVA input and output

Console objects may be introduced and input objects Scanner, Console object more suitable for the user to enter the password

Printf you can format the output, similar to c ++. Supporting different types of output,% s,% f,% x,% d, etc., (% 1 $ s refers to the first print parameter as a string) is also supported with different separators output, for example, +, () , spaces, commas, etc., there is also support java.time, to date do different outputs. The figure below illustrates a method using the characteristic parameters printf.

Input and output document scanner through the object, and the object is to build printerwriter.

Java Flow Control

for, while, if there are cyclic block-level scope, not referenced scope variables defined outside the action is also required floating point judgment equal, because of rounding errors.

tagged break, can quickly jump nested loops.

Java large value

Biglnteger and BigDecimal (java.math package) can handle these two classes contain values ​​of any length sequence of numbers, as java not override, it is necessary to subtract from the defined class of multiplication and division.

JAVA Array

Array type is generally + [] is defined in the form of, integer array default value is 0, where the size of the array by a new type [n], n can be a constant or may be variable. Array list can expand the size of the array.

It belongs to the class ARRAY array having interabel interface can be achieved for (type element: collection) cycle

Allowing the array length is zero, but is different from null.

Values in the array represents the distribution value of heap pointer , therefore, shallow copy will share the same copy of the memory array. Arrays can not be applied from the same operation as pointers c ++

java multiple nested array is an array in fact, represents the subarray array of pointers.

 

 

Published 15 original articles · won praise 1 · views 138

Guess you like

Origin blog.csdn.net/qq_17236715/article/details/103569542