Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

OPI_LR2011_ch3

.pdf
Скачиваний:
4
Добавлен:
07.02.2016
Размер:
1.31 Mб
Скачать

,

“ ”

6.050103 “' (” ( + )

II. Java

2011

2

. (

6.050103 “' (”( + ). / 000. Java / 5. .. . , 6. . 7, .. .. . . –

((: :;, 2011. – 104 .

5:

5. .. . , . . .,

 

6. . 7,

 

.. .. . , . . ., . .

=: >. .. >, . . .,

?

: 5. ?. ', . . .,

(

+

' A

“ ” 2011 .

3

...........................................................................................................

6

1 1 ! " # Java....................................

7

1.1

.........................................................................................

7

1.2

. .............................................................

7

1.2.1 C D E > =...........................................

9

1.2.2 0.................................................................................................

10

1.2.3 ' .................................................

10

1.2.4 E ......................................................................................

13

1.2.5 . @..................................................................

13

1.2.6 .........................................................................................

13

1.2.7 .............................................................................................

20

1.3

............................................................................

21

1.4

...........................................................................................

22

1.5

C .......................................................................

22

2 2 " ( ) * +,-* , ( +(

....24

2.1

.......................................................................................

24

2.2

. ...........................................................

24

2.3

............................................................................

31

2.4

...........................................................................................

32

2.5

C .......................................................................

32

3 3 01-,0 " (

 

* ! " ) " Java............................................................................

33

3.1

.......................................................................................

33

3.2

. ...........................................................

33

3.2.1 G ...............................................................

33

3.2.2 5 ............................................................

37

3.2.3 . ................................................................

38

3.2.4 C Object ......................................................................................

38

3.2.5 C ........................................................................

39

3.2.6 . new...................................................................................

40

3.2.7 > .....................................................................

40

3.2.8 C Complex ..................................................................................

43

3.3

............................................................................

45

 

4

 

3.4

...........................................................................................

47

3.5

C .......................................................................

47

4 4 3 1( 4 , ( +( 4 ............................

48

4.1

.......................................................................................

48

4.2

. ...........................................................

48

4.2.1 ' ......................................................

49

4.2.2 0 ....................................................................

50

4.2.3 0 +.......................................................................................

50

4.2.4 Design patterns .................................................................................

52

4.3

............................................................................

54

4.4

...........................................................................................

55

4.5

C .......................................................................

56

5 5 7 4-7 14.....................................

57

5.1

.......................................................................................

57

5.2

. ...........................................................

57

5.2.1 C Boolean C Character..........................................................

58

5.2.2 C Biglnteger ................................................................................

61

5.2.3 C Big Decimal.............................................................................

64

5.3

............................................................................

67

5.4

...........................................................................................

68

5.5

C .......................................................................

68

6 6 8 # )91 !4...................................

69

6.1

.......................................................................................

69

6.2

. ...........................................................

69

6.3

............................................................................

77

6.4

...........................................................................................

78

6.5

C .......................................................................

79

7 7 7 4-1 7(1;,<.......................................

80

7.1

.......................................................................................

80

7.2

. ...........................................................

80

7.2.1 C Vector ......................................................................................

80

7.2.2 C Stack C Hashtable C Properties....................................

82

7.2.3 0 + Collection .......................................................................

86

7.2.4 0 + ListIterator......................................................................

87

7.2.5 C ...........................................................................................

88

7.3

............................................................................

90

 

5

 

7.4

...........................................................................................

93

7.5

C .......................................................................

94

8 8 7 4-47, 4........................................

95

8.1

.......................................................................................

95

8.2

. ...........................................................

95

8.2.1 = ..........................................................................

95

8.2.2 e ........................................................................

96

8.2.3 = .................................................................

97

8.2.4 . ( .....................................................

100

8.2.5 ? f @..................................................................

101

8.3

..........................................................................

102

8.4

.........................................................................................

103

8.5

C .....................................................................

103

, (..............................................................................................

104

6

>3

E

f + Java

? +

@ @. ,

( ,

. ; ,

, . ;

, . '

( g .

E ( ( f

+ , ( f '@

.

f :

g( @ ,

, +, , i ,

, i f , );

;

;

;

;

.

@ + A4(210 × 297 ). ; i @ f g. '

- 20 . 5 g @@ @

i @ +.

'

,

, g ,

+ f@

. >

. E

, .

7

1 ? 8 8 8 ? 1

@ JAVA

1.1 ( 4

? ( @ Java.

1.2 " , ( ( 4-, ",9 ! ,

', f@, g .

1.1 g , @ Java. ' 1.1. ' g @ Java;

class HelloWorld{

public static void main(String[] args){ System.out.println("Hello, XXI Century World!");

} }

: (

Java.

m- f @ ,

g (class).

' f ( class,

' , Helloworld. , i

f , f + (

(class body).

? @ +. D ( f Java "+",

g . @ .

. ' main,

f .

' f (

+(modifiers). : public

f, i ; static f

( main()

. + ' , main()

.

Java f .

. (, g - . ; +, ' f ' , i

main() @ , +

8

g Java. ' Java g

main() , g @ , i f ' +.

g , ( + ' HelloWorld.java . ' f ,

@ ' + :

javac HelloWorld.java

C + - , ' Helloworld.class g + .

g , g

' ( +):

Java HelloWorld

: ' :

Hello, 21st Century World!

: g class .

: . 1.1 , f Command Prompt

MS Windows 2000.

= 1.1 – ? Command Prompt

' i @

@ " " g - f f.

9

1.2.1 4 C,7, , , 4!" 74 8)914

Java (

.

C,7,

D (

:

+: +5, -7, 12345678;

+, @ : 027, -0326, 0777 ;

+ 8 9;

: ( L

l, +

long( . (): +25L, -0371, Oxff, OXDFDF1.

: ( F f,

+ float( . (): 3.5f, -45.67F, 4.7e-5f. ( D( d): 0.045D, - 456.77889d, i f double, ,

@ + double.

4!" 74

E @

+.

E ( +: ' ', ' N ', ' ? '. C @ @ + @

@ @:

'\n ' - newline ASCII 10;

'\r ' - CR 13;

'\f ' - FF 12;

'\b ' - BS 8;

'\t ' - :; 9;

'\\ ' - ;

'\" ' - ;

'\' ' - +.

> @ + char( . (). ' Unicode @

' \u0410 ' - 5, ' \u042F ' - G,

' \u0430 ' - , ' \044F ' - .

8)914

= . C @

@ , @ @ @,

10

, , +, ( @. = (

g ,

( @ , @ -

.

. :

"D \n " "\">\" - /!"

= (

, g.

E ,

@.

" " + " " f "

".

1.2.2 !(

0(names) , , g 'f (

( – +(idenifiers))

(qualified names). 0 + Java @

Java (Java letters) + 0-9, g

+ ( +. Java

' , $

_, +.

1.2.3 3 4!, 4" , 4 4 9 4D , ( ;,<

? , Java,

: (primitive types) (reference types).

' (arrays), (classes)

+(interfaces).

' . • (

( ) boolean (numeric). E .

D ' : byte, short, int, long, char.

E : float double.

: . 1.2 f Java.

Тут вы можете оставить комментарий к выбранному абзацу или сообщить об ошибке.

Оставленные комментарии видны всем.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]