Documente Academic
Documente Profesional
Documente Cultură
Cristian Frsinaru
Cuprins
1 Introducere n Java
1.1 Ce este Java ? . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.2
1.3
1.4
1.5
1.6
11
11
11
12
13
14
16
16
16
17
17
19
19
20
21
21
22
24
24
25
26
26
26
26
28
28
29
CUPRINS
1.6.5 Sortarea vectorilor - clasa Arrays
............
1.6.6 Vectori cu dimensiune variabila si eterogeni . . . . . .
1.7 S
........................
1.8 Folosirea argumentelor de la linia de comanda . . . . . . . . .
1.8.1
1.8.2
1.8.3
Transmiterea argumentelor . . . . . . . . . . . . . . . .
Primirea argumentelor . . . . . . . . . . . . . . . . . .
Argumente numerice . . . . . . . . . . . . . . . . . . .
2 Obiecte si clase
2.1 Ciclul de viata al unui obiect . . . . . . . . . . . . . . . . . . .
2.2
2.3
2.4
2.5
2.6
2.7
29
30
30
31
31
32
34
35
35
35
37
38
39
39
40
41
42
46
49
50
50
52
53
56
57
58
59
59
61
62
63
64
64
66
66
67
67
CUPRINS
2.7.1
3
Declararea unei clase abstracte
.............
68
68
71
71
71
74
75
3 Exceptii
3.1 Ce sunt exceptiile ? . . . . . . . . . . . . . . . . . . . . . . . .
3.2
3.3
3.4
3.5
3.6
3.7
77
77
.......
4 Intrari si iesiri
4.1 Introducere . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2
78
82
85
85
87
89
90
91
92
95
95
........
95
96
97
98
99
99
4.2.2
4.2.3
4.2.4
4.2.5
4.2.6
4.2.7
. . . . . . . . . . . . . 108
4.3.2
. . . . 109
CUPRINS
4.4 Fluxuri standard de intrare si iesire . . . . . . . . . . . . . . . 111
4.4.1
4.4.2
4.4.3
4.4.4
121
. . . . . . . . . . . . . . . . . . . . 134
Interfata Comparable
Interfata Comparator
. . . . . . . . . . . . . . . . . . . 139
. . . . . . . . . . . . . . . . . . . 141
145
CUPRINS
6.2.2
6.3
5
Organizarea unitatilor de compilare (.class)
. . . . . 154
7 Colectii
7.1 Introducere . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
7.2
7.3
7.4
7.5
7.6
161
8.2
177
9.3
199
CUPRINS
9.3.2 Gestionarul FlowLayout . . . . . . . . . . . . . . . . . 209
9.3.3 Gestionarul BorderLayout . . . . . . . . . . . . . . . . 210
9.3.4 Gestionarul GridLayout
. . . . . . . . . . . . . . . . . 211
9.3.5 Gestionarul CardLayout . . . . . . . . . . . . . . . . . 212
9.3.6 Gestionarul GridBagLayout . . . . . . . . . . . . . . . 214
9.3.7 Gruparea componentelor (Clasa Panel) . . . . . . . . . 218
9.4 Tratarea evenimentelor . . . . . . . . . . . . . . . . . . . . . . 219
9.4.1
9.4.2
9.4.3
9.7.5
Clasa Choice
9.7.6
9.7.7
9.7.8
Clasa ScrollPane
9.7.9
. . . . . . . . . . . . . . . . . . . . . . . 257
. . . . . . . . . . . . . . . . . . . . . 262
269
CUPRINS
10.2.2 Primitive grace
7
. . . . . . . . . . . . . . . . . . . . . 275
11.6.7 Dialoguri
. . . . . . . . . . . . . . . . . . . . . . . . . 335
11.7 Desenarea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
11.7.1 Metode specice
. . . . . . . . . . . . . . . . . . . . . 336
11.7.2 Consideratii generale . . . . . . . . . . . . . . . . . . . 338
11.8 Look and Feel . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
299
CUPRINS
12 Fire de executie
12.1 Introducere . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
343
383
14 Appleturi
14.1 Introducere . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
14.2 Crearea unui applet simplu . . . . . . . . . . . . . . . . . . . . 402
. . . . . . . . . . . . . . . . . . . . . . . . . 410
401
CUPRINS
15 Lucrul cu baze de date
423
15.1 Introducere . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
15.1.1 Generalitati despre baze de date . . . . . . . . . . . . . 423
15.1.2 JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
15.2 Conectarea la o baza de date . . . . . . . . . . . . . . . . . . . 425
15.2.1 Inregistrarea unui driver . . . . . . . . . . . . . . . . . 426
15.2.2 Specicarea unei baze de date . . . . . . . . . . . . . . 427
15.2.3 Tipuri de drivere . . . . . . . . . . . . . . . . . . . . . 428
15.2.4 Realizarea unei conexiuni
. . . . . . . . . . . . . . . . 430
15.3 Efectuarea de secvente SQL . . . . . . . . . . . . . . . . . . . 431
15.3.1 Interfata Statement . . . . . . . . . . . . . . . . . . . . 432
15.3.2 Interfata PreparedStatement . . . . . . . . . . . . . . . 434
15.3.3 Interfata CallableStatement . . . . . . . . . . . . . . . 437
15.3.4 Obtinerea si prelucrarea rezultatelor
. . . . . . . . . . 438
15.3.5 Interfata ResultSet . . . . . . . . . . . . . . . . . . . . 438
15.3.6 Exemplu simplu . . . . . . . . . . . . . . . . . . . . . . 440
15.4 Lucrul cu meta-date
. . . . . . . . . . . . . . . . . . . . . . . 442
15.4.1 Interfata DatabaseMetaData . . . . . . . . . . . . . . . 442
15.4.2 Interfata ResultSetMetaData
. . . . . . . . . . . . . . 443
16 Lucrul dinamic cu clase
445
16.1 Incarcarea claselor n memorie . . . . . . . . . . . . . . . . . . 445
16.2 Mecanismul reectarii
. . . . . . . . . . . . . . . . . . . . . . 452
16.2.1 Examinarea claselor si interfetelor . . . . . . . . . . . . 453
16.2.2 Manipularea obiectelor . . . . . . . . . . . . . . . . . . 456
16.2.3 Lucrul dinamic cu vectori
................4