You are on page 1of 10

2. Java.

.
NetBeans;
Eclipse;
IntelijIDEA;
Sun Studio.

3. NetBeans.
.

(workspace)
, . ,
, .
NetBeans
Documents And
Settings\UserName\ \NetBeansProjects ( MS Windows XP),
UserName .
NetBeans
NetBeans
.
,
. ,
, (),
JDT, ..
(workbench)
, .

.

(perspective) ,
, .
,
.
. ,

.

,
(, , ,
.).

,
,
, , .
Window.

(project)
. , ,
, - . Java
, :
.java, .jsp, .xml, - .class.


(plug-in) ,
NetBeans. GUI
Builder. , ,
,
Tools/Plugins.

,
. Eclipse
,
,
. ,
,
, ,
, ..
4. , , Java.

.
, j
() final ( ,
).
, Java.
.
.
111 ()
056 46
0 171
: \n ( )
5. .
: Byte Short Int Long
: Double Float
6. . .
, .
?
, . ,
==, .
Java
. ,
.
: Object, JLabel, JTextField
: ( )
new:
# Cat barsik = new Cat(); // Cat
= .
Cat.
Cat .


7. .
, Java,

.
, .
(, , ).
,
.
( )

8. .

.
char.

9. . .
,

, .
: byte, short, int char,
: int,
.
long,
. double, float,
double, float
double.
,
. ,
java ,
Object, .
Java ,
.. . (class wrappers).
,
, . int char,
Integer Character.
,
. (
box) (boxing),
(unboxing).

.
Value().
10. Math.
Java Math,
. - , ,
exp.
# public static final double Pi = 3.14159265358979323846
, ,
.
Math: sin cos tg ctg log exp sqrt pow(x,y) [ x
y]

11. Java.
, . . Component,
(graphics context).
.

Color, Font.
,
(0, 0) ,
, .
.
Graphics Graphics2D,
Java 2.
, .
Graphics Graphics2D.
Java ,

Graphics getGraphics() Component
paint() update().
12. . .
(
), .
byte[] byte_array;
, byte_array
.
new
.
byte_array = new byte[100];

: byte[] byte_array = new byte[100];
0,
.
length, :
byte_array.length;
,
.

:
int[][] matrix = new int[5][8];
(),
. ,
,
, .
.
13. . .
,
. Java String,
, Java .
String .
String .
( ) ,
B, Alpha, B11jf, .
,
char, ,

toString(), Object.
14. . If, Switch.
- Pi
.
{P1; P2; P3; ...Pn}
if-else
:

# if (condition) { 1; 2; } else { 3; }
switch
, ,
.
switch () {
case 1:
1;
break;
case 2:
2;
default: * *
3;
break; }
15. .
if-else
:
# if (condition) { 1; 2; } else { 3; }
# if () {1;2;} else 3;
16. .
,
.
,
.
.
1) while
Java.
while :
# while () { ;}
2) do: while
, condition.
,
.
# do { } while (condition);
for
.
,
, .
# for (; ; ) { ;}
17. .
Java break, continue return. C
.
1) break
.
Java break, ,
break, .
2)
,
. Java continue.
,
,
(while, while do) (for). break,
continue ,
.
3) return
. return
.
18. . . .
- .
1) 2)
3) .


4) 5)
.
,
,
. :
1) ;
2) .
: ,
, ;

,
.
: ,
. ,
: ///
: , .
:
, .
(, )
,
.
- () - , :
1. ;
2. ;
3. .
===================
1) - ,

(); .

Java. ,

.
.

.
public
. ,
.
-
- .

.
:
1)
2)
.
19. . . .
2) (inheritance) -
(
), ( ) .
"-",
.

.
( ),
. , ,
, . . ,
, . ,

, (
), . Java
Object.
, .
,
.
.
20. . . .
3)
( )
, ( ).
, , , .

.
21. .
,
,
. :
1) ;
2) .
.
( )
. ,
.
22. . , .
, , -
, .

( ,
):
1. (Aggregation);
2. (Association);
3. (Inheritance);
4. (Metaclass).
1) : "" (contain)
" " , . ,
, ,
.

, (aggregation),
, , .
2) :
, ,
"", ,
(association).
, , , ,- , .

. ,
. , ,
- ,
.
"--".

23. .
:
1. ,
,
.
2.
.
3. ,

.
4. .
,
. ,
,
- .
.
5. .
6.
7. . ,
.
8. "" (framework).

, (framework),
, .
.
1. , ,
. ,
, .
2.
.
3. ,
. , ,
.
4. .
24. . . New.
-
Java .
,
- . ,
Java main.
Java,
. , ,
, class,

.
# class Point { }
Java
. , .
.
, ().

,
.
: ,

.
, .

, ,
main.
#Class Point {int i,j;}
,
. public, private,
protected, static, final, transient, volatile, .
NEW: new

.
# Point p=new Point();
25. . .
,
() .
, () .
. :
1. ( );
2. void;
3. ;
4. ( );
.
public, private, protected,
.

( ):
1. public , ,
, ;
2. protected , ,
(package);
3. private , , ,
;
4. final , ,
;
5. abstract , ,
. ,
,
abstract;
static , , ,
- .


, .
,
, .
26. .
, , , ,
, , ,
.
:
. ,
;
1. ;
2.
;
3. ,
void.
public, private protected;
4.
, ;
5.
(), super()

,
, this().
27. This. .

.
Java ,
. ,
.
, Java
.
,
. ,
, .
, ,
.
, .
28. . Super. (override).
,
.
super() ,
.
. ,

.
30. Java.
1.
System.out.print().
System,
print println out System. ,

, BufferedReader,
.
2. ,
.
, Swing.

InputDialog:
# import javax.swing.*;
# public class Reader2 {
# public static void main(String[] args) {
# String s = "";
# s=JOptionPane.showInputDialog(null," ");
# JOptionPane.showMessageDialog(null, ", "+s);}}
31. .
102
32. .
, ,
- ,
JVM. .
Applet Panel,
,
, ,
Graphics.
main() .
,
.
, , , ,
ActionListener
, .