Escape unicode Unicode Input Character Unicode Escape Raw

  • Slides: 28
Download presentation

Escape последовательности unicode Unicode. Input. Character: Unicode. Escape Raw. Input. Character Unicode. Escape:

Escape последовательности unicode Unicode. Input. Character: Unicode. Escape Raw. Input. Character Unicode. Escape: Unicode. Marker Hex. Digit Unicode. Marker: u Unicode. Marker u Raw. Input. Character: any Unicode character Hex. Digit: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F Учитывается “четность” количества символов ‘’, и номер прохода: “\u 2297=u 2297” транслируется в “ u 2 2 9 7 = “ “u 005 Cu 005 A” транслируется в “ u 0 0 5 A” , но не в “z” Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 3

Специальные символы Line. Terminator: the ASCII LF character, also known as "newline" the ASCII

Специальные символы Line. Terminator: the ASCII LF character, also known as "newline" the ASCII CR character, also known as "return" the ASCII CR character followed by the ASCII LF character Input. Character: Unicode. Input. Character but not CR or LF White. Space: the ASCII SP character, also known as "space" the ASCII HT character, also known as "horizontal tab" the ASCII FF character, also known as "form feed" Line. Terminator Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 4

Последовательность входных элементов Input: Input. Elementsopt Subopt Input. Elements: Input. Elements Input. Element: White.

Последовательность входных элементов Input: Input. Elementsopt Subopt Input. Elements: Input. Elements Input. Element: White. Space Comment Token: Identifier Keyword Literal Separator Operator Sub: the ASCII SUB character, also known as "control-Z" Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 5

Идентификаторы Identifier: Identifier. Chars but not a Keyword or Boolean. Literal or Null. Literal

Идентификаторы Identifier: Identifier. Chars but not a Keyword or Boolean. Literal or Null. Literal Identifier. Chars: Java. Letter Identifier. Chars Java. Letter. Or. Digit Java. Letter: any Unicode character that is a Java letter Java. Letter. Or. Digit: any Unicode character that is a Java letter-or-digit Символы Java включают в себя ASCII символы A-Z (u 0041 -u 005 A), a-z (u 0061 -u 007 A), _ (u 005 F), $ (u 0024) Цифры Java включают цифры ASCII 0 -9 (u 0030 -u 0039) Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 7

Ключевые слова Keyword: one of abstract boolean break byte case default do double else

Ключевые слова Keyword: one of abstract boolean break byte case default do double else extends if implements import instanceof int private protected public return short this throws transient try catch class finally float interface long native static strictfp super void char volatile while const goto for package new synchronized switch assert continue enum Слова goto и const зарезервированы. Ключевое слово assert введено в JDK 1. 4, enum – в JDK 1. 5 true, false и null технически являются литерными константами Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 9

Литерные константы (literals) Literal: Integer. Literal Floating. Point. Literal Boolean. Literal Character. Literal String.

Литерные константы (literals) Literal: Integer. Literal Floating. Point. Literal Boolean. Literal Character. Literal String. Literal Null. Literal литерные константы типа int (диапазон от – 231 до 231): 0 2 0372 0 x. Dada. Cafe 1996 0 x 00 FF литерные константы типа long (диапазон от – 263 до 263): 0 l 0777 L 0 x 10000 L 2147483648 L 0 x. C 0 B 0 L Новосибирск, 2004 (С) Всеволод Рылов, все права защищены 10

Строковые литералы и объекты String package test; class Test { public static void main(String[]

Строковые литералы и объекты String package test; class Test { public static void main(String[] args) { String hello = "Hello", lo = "lo"; System. out. print((hello == "Hello") + " "); System. out. print((Other. hello == hello) + " "); System. out. print((other. Other. hello == hello) + " "); System. out. print((hello == ("Hel"+"lo")) + " "); System. out. print((hello == ("Hel"+lo)) + " "); System. out. println(hello == ("Hel"+lo). intern()); } } class Other { static final String hello = "Hello"; } package other; public class Other { hello = "Hello"; } Новосибирск, 2004 public final static String (С) Всеволод Рылов, все права защищены 12

Типы и значения выражений Type: Primitive. Type Reference. Type Primitive. Type: Numeric. Type boolean

Типы и значения выражений Type: Primitive. Type Reference. Type Primitive. Type: Numeric. Type boolean Reference. Type: Class. Or. Interface. Type Array. Type Class. Or. Interface. Type: Class. Type Interface. Type Numeric. Type: Integral. Type Floating. Point. Type Class. Type: Type. Name Integral. Type: one of Interface. Type: Type. Name byte short int long char Floating. Point. Type: one of float double Новосибирск, 2004 Array. Type: Type [ ] (С) Всеволод Рылов, все права защищены 14

Блоки (грамматика) Block: { Block. Statementsopt } Block. Statements: Block. Statements Block. Statement: Local.

Блоки (грамматика) Block: { Block. Statementsopt } Block. Statements: Block. Statements Block. Statement: Local. Variable. Declaration. Statement Class. Declaration Statement Local. Variable. Declaration. Statement: Local. Variable. Declaration ; Новосибирск, 2004 Local. Variable. Declaration: finalopt Type Variable. Declarators: Variable. Declarators , Variable. Declarator: Variable. Declarator. Id =Variable. Initializer Variable. Declarator. Id: Identifier Variable. Declarator. Id [ ] Variable. Initializer: Expression Array. Initializer (С) Всеволод Рылов, все права защищены 20