Beruflich Dokumente
Kultur Dokumente
اﻟﺒﻮﺻﻠﺔ اﻟﺘﻘﻨﻴﺔ
www.boosla.com
palteam_ps@yahoo.com !" # $ %#
Java& ' ( )
Sun Microsystems
%& ' $ ! "# $
$( )"' ' Sun
." +)$ " , - "*)"Write once, Run Everywhere"
"Java 3 1' 2 + 0 / )"' & 0 -
$ 3 6 5 JVM ! 4 )Virtual Machine"
$ !+ 9 : ;& 0 7 ' !4 2 2 8
95 " 46 9 5 $ 8 + ' $ +' +
!+ 9 $ ) '0 8 + ' *) ) *) < "
@ *) $ " " ?=> Linux ( !+ 9 2 Windows
<8 + ' &
? ' & A$ !+ / 4 9 $ 5
35 7 Web - 9 & D+ 8 ' BC 9> '
FD+ % (Java Applets) ' @ +E' ' @ +5 9 5
- 7D! 3$ 9 "# 9 5 35 ' G /(
. B 0
+ + - $ C C ' 8 ' $ '
& + " 9 -' $ & H % I A
.? 2 ) $
J "4 ' !+ B $ +) !4 C
J B K4 C 0 +L 4 J @ +E' 7
B 0 9 "4 M N M) , & B#
< D $+ 8 ' E % & (Garbage Collector) D+
palteam_ps@yahoo.com !" # $ %#
/ D! / " " "' B '# )
" % -) ," O 4) / D! # ' N MG
Object/!
+ ," ' " C " ,C K( !4 ;& Sun 3 "
: + &)
palteam_ps@yahoo.com !" # $ %#
%
Object Oriented / " G ' ' " ' C P
"4 ' $&' *& " > Programming (OOP) :
" ' 8 ' " ' + " '
- B " $ )8 ' 9 8 + ' *" - 95 35
" Q, >), > ' ; 3 ' @ +R 8 + '
/" G ' ' ) << " 8 + ' @ +' ," +
F ) " + '9 * ! + @ +5 ," " , D'
!D , ' ," 8 + ' @ +' ," '!) ' << 8 + ' @ +5
. > !4 $ Object !+ )
palteam_ps@yahoo.com !" # $ %#
! *+# )
“JVM” : ,# *
#, JAVA Virtual Machine , , ' ! 4 JVM /
<$ +) )B 9 $ $ ( +E'
8 ' $ 8 + ' +I Software ' @ +5 9 , D
8 ' D ' ,C G 9 S ) 2 C+5 $ + $ Runtime
$ +) C & C >$ + D
+) ' ! 4 JVM " " 5 " ' ," $ + > 9
) WINDOWS $ + - 8 + ' &5 = << $
JVM " C 9 C 95 $ >- 8 + ' ) UNIX ,
.8 + ' $ ' " +
Java Applet -2
" " E' W + +T S! !4 ! *& ' V +) V +
$ ' HTML / "4 $=4 2 " > Applet 8 + ' &
)HTML . U / 2 " server " 4 9 Applet 8 + '
52 + & HTML / $4 " ( " Applet @ +5
. " F " $=4 X @
: - # Java Application -3
+B $ O 4G ' B ' ,I + ' 2' 0'
+ +T 8 ' "W +) + +R ' S" ' $
@ 0' *) " " 5 , + > +) S3 ) M
CLIENTSERVER . ' ' K 4 ) DISKTOP '
palteam_ps@yahoo.com !" # $ %#
! , "
#+
O 4G G B ' ' , D *) F ) '
B +9 %& + $ #- ' "4 +
- 0 %& <8 + ' $
< $ D' ' 5
x*y*z
palteam_ps@yahoo.com !" # $ %#
#+ . !
palteam_ps@yahoo.com !" # $ %#
V + $ 8 + ' $ $=4 , ' "4
: $ " $
Format
&/ 0
8-bit two's complement
byte
!
Byte-
length
integer
Short integer
short 16-bit two's complement
" #$% & %' ()* # + , - . /0&1
2- 34
Integer
int 32-bit two's complement
34 " #$% & %' ()* # + , -
! 2-
Long integer
long 64-bit two's complement
34 " #$% & %' ()* # + , -
! 2-
"" + &/ 0
Single-precision floating point
float 32-bit IEEE 754
34 " #$% & %' ()* #$45 6 )7*
! 2-
Double-precision floating point
double 64-bit IEEE 754
34 " #$% & %' ()* #$45 6 )7*
! 2-
palteam_ps@yahoo.com !" # $ %#
1 2 3
A single character
char 16-bit Unicode character
8 % 948
A boolean value (true or false)
boolean true or false
;+ 4+< %' ;+ : !: # +)
Import java.io.*;
Public class Count {
Public static void countChars(Reader in)
throws IOException
{
int count = 0;
palteam_ps@yahoo.com !" # $ %#
5 6
" # # ) B $ 95 L + G >
# + Array U' / %& - + V + + + '
2 ArrayV + + ! ++ V +) 9 +
B $ + )" +, > + ) # G B $ < !4
"4 + & ? ) + / ;& $> "#A /
Strings.V +
Arrays
Z $> ++
int[] arrayOfInts;
arrayOfInts[j] = j;
palteam_ps@yahoo.com = !" # $ %#
<? ! # G V + ;+ A 2D '$ G +#
+ #2 !+ $ +D3) >
Strings
< # G $"' / G B $ 2+ 0' V + ' 2' V + &
B > 0 ? @ " 4A
palteam_ps@yahoo.com !" # $ %#
;& A2 "" 2D '$ G +#
? =
!"
* ) * +, , - +*$ $ %& ' ($ #
4 2 3 & 0 - . / 0 1 0
7 3 # &'
Z $ " ) ++
9+ G
@ 4G try-catch-finally, throw
)
break, continue, label: , return
D 4
palteam_ps@yahoo.com !" # $ %#
!' = > ' < 3+ ; 83 #9 :
# &4 =4 B + G + " $3
* Y B3+ * X &5 $ + => 8 + '
<& =
8 + ' @ 4 / + )B + G + Z; 0
<B# &5
+ , C %+ " I +) ;& 2 + + "' -
$ ' ' D4 , ;& > G , O G' )
N '' + $ + < G % ) $ $> O
<$ !D
palteam_ps@yahoo.com !" # $ %#
" $3
if - else @ ' ? 0
if ( ' )
Statement
else
Statement
palteam_ps@yahoo.com !" # $ %#
/! ' ) ' % %+ N A $ >
! = -
>- $ = ' testscore "4 +
Z ?O ' grade "4 +
int testscore;
char grade;
palteam_ps@yahoo.com !" # $ %#
switch - case 0
int month;
switch (month) {
case 1: System.out.println(“January”); break;
case 2: System.out.println(“February”); break;
case 3: System.out.println(“March”); break;
case 4: System.out.println(“April”); break;
case 5: System.out.println(“May”); break;
case 6: System.out.println(“June”); break;
case 7: System.out.println(“July”); break;
case 8: System.out.println(“August”); break;
case 9: System.out.println(“September”);
break;
case 10: System.out.println(“October”); break;
case 11: System.out.println(“November”);
break;
case 12: System.out.println(“December”);
break;
}
palteam_ps@yahoo.com !" # $ %#
'
for ? 0
statements
Z $> &4I+
int i;
...
// @ ' # +
...
palteam_ps@yahoo.com !" # $ %#
while & 0
while ( ' )
statement
Z $> ++
while (X != 10) {
X++;
& + 0 do while
do {
statements
} while (booleanExpression);
palteam_ps@yahoo.com !" # $ %#
Z $> O +
int c;
...
do {
c-- ;
...
} while (c != -1);
6!
break A/ 0
+ ' , D @C - & /# G O 4) D %+
palteam_ps@yahoo.com !" # $ %#
I' > Z +U' % & B' + > '
Z
breakToHere: someJavaStatement
break breakToHere;
<
palteam_ps@yahoo.com = !" # $ %#
Inheritance 4
oop ! !4 ' ( 95 G N' L + "#.
9 #" 2 D! > ' + “class” /+! > '
+ "+ +
public ….
* 2 J $ ) ' 2> )B ” class ” /+! *) $ '
public
super class-G /+! ' 2 D! *& /+! * *& /+! +
subclass2 + 4) /+! *& /+!
" )- ) 8 + ' ' 8 ' >)% , ' 8 '
] 0 *) * " class *) abstract classes '
abstract classes subclass +!' 4: ' << $ '
)+ " " 2+ " ( abstract classes + method
D "4 + > )0 V 3 3) / + )-
subclass B3+ ) $'#extends
palteam_ps@yahoo.com !" # $ %#
<$ G "" P > Zopp U D
superclass -G /! 9 0
subclass ' /! 9 0
<extends 0 >
Z =
ZS )
Z*) 7 ! MF -G /! N M ' /! N M *) ) +
palteam_ps@yahoo.com !" # $ %#
Z_> >
Z_ '
< /! -G /! 9 5 super $
Z_ 4
< > + Z is a U D
Z_ "
U 0 %& ' /! N 9 5 -G /! N $
< exeptionZ *) @ +> +" 8+ casting U B3+ &5 ^ * casting
Z_ '
palteam_ps@yahoo.com !" # $ %#
Z final V + / D! 0 Pa
Zfinalizer Pa
?super.finalizerA
palteam_ps@yahoo.com !" # $ %#
Exceptions ; 34 9
palteam_ps@yahoo.com !" # $ %#
"
"
public MyClass{
…..
try{ int x= myMethod() ; }
catch(Excrption e){ ….. }
…..
}
palteam_ps@yahoo.com !" # $ %#
RuntimeException ; 34 9
/ D! Exception) / D! + N M)A @ +> %+
Exception ./! ' *& RuntimeException /!
' 4 4 " ' Compiler % 7 @ +> ;&
. '
RuntimeException) /! N M" 9+ 'A @ +> ;&
N V + 2+ 8 + *& /! V + ' ' " + @ 4) -' '
. ) I 4 V + (= @ +>
4 "4 A ! $ " ' Catch it %+ %& B
< ?% & " ) 5A '
; 34 9 = D !4
=> a /! N M9 * #$ @ 5 ClassCastException :
.2( ' " 2( +') " a /! FD+ F " " /! 9 5...
2 + ' D! + N M C4 ArrayStoreException :
. D! 2' + - +
2 O = null ( 2 # N M $ $ NullPointerException :
data member .$ ;" + 5 ) +' ) method $ ; new )
palteam_ps@yahoo.com !" # $ %#
, ' 2 2 A 2> " @ +> B $ Z$ G 4 95 " +
(2> " $
"
\try
? D 4 / D! V + A > ) ) @ +> "# " +
& D+ $ ++ Catch $ + H +' 2 &D+ @ +> *) " & &5
finally
cStatment1
cStatment2
cStatment3
cStatment4
[
"
catch(IOException e){
try 2+ / O *& @ +> 8 "
2( '6 " ) ) IOException ) + A ! ' "" V + @ +> 8
$ + > " C= @ R &4 + O
finally
$ + IOException V + try / & @ +> &5
. catch
' @ +> /& method $ ) /! 5 ) << catch % + E
throws
) 4 "4 ,"( (
$ ' V + @ +> 5 5 <<< + > 4 "4
. 2 RuntimeException
palteam_ps@yahoo.com !" # $ %#
C @ 4) 9 $! 2 ' 5
.% + '
}
"
catch(Exception e){}
"
} " G % *& " finally{
: =
.@ +> /&# 2+ 8 + Statment2; & D+ ) N D'
> ' catch $ K 95 $ + > H +' Statment1; & D+ $! E
= ) + & finally 95 $ + > (= @ +>
Statment3;
Statment4;
.8 + ' @C ) " + ;& 9 ; ' + - & D+ *
palteam_ps@yahoo.com !" # $ %#
. 3 " 4 finally Z =
Z @ +> $ ( * Throwable /! + N MG
palteam_ps@yahoo.com = !" # $ %#
" $ Record of execution Stack & D+ F" $
<<<< @ +>
"
"
class class1\
method1 () { method2[c?A
palteam_ps@yahoo.com !" # $ %#
"
class class2\
method2e \ ?A
"
palteam_ps@yahoo.com !" # $ %#
*& " # PackageName.class1.method1: method2
@ " 2
palteam_ps@yahoo.com !" # $ %#
Interfaces D
"" + " +) 3 O 4G V +G 2 "4 V +
0( 9 * ;& 0 (D +3 )- + !+
(D " ) !+ K( !4
"
Attributes D! 7 ! 0' ! O +
/ " ;& ) + Shadows ) Public $> $ ""
* (D O 4) > FD+' ,"
Y <<< K( !4 " /( (D 3 ( !+ FD+ 9
9 - "" *& " "' K( !4 /( ;& / "" +
;& 3 ," !+ " ) + 0 ( *)
D )- *) Module ) Namespace O 9 /
) ) ' f ++ @ 5 3 ! M
Default "4 ' 3 !4 "" O 4) 3 )
!+ 7 ! "+ Private ) Public $> $ ! "" "4
( 3 "4 "+ Shadows ) Overloads "4
palteam_ps@yahoo.com !" # $ %#
Public $ ! "" "4 ' (D ;& !+ = R
7 ! (D % O 9 ; %+ *& G 3
I/ ' " )"' ) $3D "+ 3
>G N' : O +
K( !4 N ' 9 * K4 G / + )
"
Interface IPerson
End Interface
' N' / ++ )
"
Interface ISomeMath
palteam_ps@yahoo.com !" # $ %#
Function Multiply(ByVal a As Integer, ByVal b As
Integer) As Double
End Interface
K4 G / " / + )
"
Interface IPhonebook
Inherits IPerson
Sub ShowInformations?A
End Interface
"
Implements IPhonebook
palteam_ps@yahoo.com !" # $ %#
Get
End Get
End Property
<<<<<<<
End Class
"
Class SomeTest
Implements IPerson
Implements ISomeMath
Get
End Get
End Property
<<<<<<<
Implements ISomeMath.AddNumbers
palteam_ps@yahoo.com !" # $ %#
End Function
<<<<<<<
End Class
"
Interface IPhonebook
Interface IPersone
End Interface
Sub ShowInformations?A
End Interface
palteam_ps@yahoo.com !" # $ %#
(D 3 "4
"
Class test
Implements IPhonebook
Implements IPhonebook.IPersone
<<<<<<<
End Class
palteam_ps@yahoo.com !" # $ %#
Abstract E A3 0
9 $" * *) " B# * / +!G ; " /+!
e2 0 "] $D ) & 9+
palteam_ps@yahoo.com = !" # $ %#
/+! / $'# abstract D &' + # =
B' )
.." 2+ 9 "
/+! + ' B' " " B' )" /+! $4 " ) =+
" e G $4 " " *) B3 = )- *&
" *) + ) "' F # " D / 3 )method print U
" 9+ =' *& % & 0 ' # *& IMPPRINT /+! + ) >
.. ' ' #
" /+! object &4 ; )- ] main )
V 3 = N'
" M /+! $4 "' ," B' B3 -
9 0 B & D+ " /+! *& " /+! 9 - -
"4
," M B' 9 * " /+! 9 7 ! -
" M -G /+! 9 S" ' /+! 5 -
abstract class object +! 8 + *& I 4 V 3 + -
F
<< +@ FI - $ ) $ 4"R ' %+
palteam_ps@yahoo.com !" # $ %#
)/ 95 ' $ $ 9 $ A InputStreamReaderP
?C
" 7'!
"
import java.ioca<
class BRRead\
char cc
InputStreamReader(System.inc??
palteam_ps@yahoo.com !" # $ %#
System.out.println(”Enter charactersc?h
c = (char) br.readc?A
System.out.println(cc?
$ / ' +" ' $4"+ ) " + "+ " ' $ 4"5 0' "
char +
) +# / 95 ) $ >" $ )
/ $=4 " ' ,@
Z"
import java.ioca<
class BRRead\
String cc
InputStreamReader(System.inc??
System.out.println(”Enter charactersc?h
c = br.readLinec?A
System.out.println(cc?
palteam_ps@yahoo.com !" # $ %#
,@ # 9 $ " % & read $"' readLine B' "4 =+
enter / +' 3 "# C B / ,"
< string + $ ) =+
"
import java.util.Scannerc
class IN
palteam_ps@yahoo.com !" # $ %#
scanner K 4 class$ "4 $ 4"5 ;& 3 )
G 9
public H ' +/ "'
+" =>
palteam_ps@yahoo.com !" # $ %#
}
}
protected 9 5 ) I+
> ' K 4 2+ public UU ' 2 ' J &
& extends 0 "+ class protected $ / ' + "+ =>
protected + &5 3 ) > 0 )B F=
palteam_ps@yahoo.com !" # $ %#
"#
JBULDER 7 3 #
palteam_ps@yahoo.com !" # $ %#
palteam_ps@yahoo.com !" # $ %#
-+!,
palteam_ps@yahoo.com !" # $ %#
)
V @ +5 % 8 + ' 9 $ @"' PZ 9 G , ! <
% ?new project A " " V @ +5 "+ ' 73
< +> , ! 3
) C4 V + 4+ PZ + > , ! <
< 3 3 ' +
) 2 " " 5 "" + V =4 "" + PZ > > , ! <
< 2+ C4 B3
2+ V "" R + PZ ' , ! <
6 ; + 4") *& V + + @ +5 3+
< 3
palteam_ps@yahoo.com = !" # $ %#
( +E' + 8 ' 0' 8 + ' 9 $ +)"' "# + &
palteam_ps@yahoo.com !" # $ %#
HELLOW 9 B' 8 + ' => 2 ' 8 + '$ 9 $>
PZ ! ' 73 WORD
palteam_ps@yahoo.com !" # $ %#
palteam_ps@yahoo.com !" # $ %#
PZ B' + 9 8 + ' ' "'
palteam_ps@yahoo.com !" # $ %#
JCreator 7 3 #
H 3
palteam_ps@yahoo.com !" # $ %#
2
palteam_ps@yahoo.com !" # $ %#
4
palteam_ps@yahoo.com !" # $ %#
6
palteam_ps@yahoo.com !" # $ %#
8
- 7 9 8 + ' ! 4 @ +5 =+ $ "'
8 + ' 7D G F C' 3
ZV ' @"' 7
1
palteam_ps@yahoo.com !" # $ %#
2
palteam_ps@yahoo.com = !" # $ %#
4
{V @"' $'# 2 D 8 + ' + ) "' }
8 + ' & D+ .
palteam_ps@yahoo.com !" # $ %#
TextPad 7 3 #
palteam_ps@yahoo.com !" # $ %#
Next DEF K L+" #M3 I $ N+O40 #+) P
palteam_ps@yahoo.com !" # $ %#
$=4 " ) 52 8 + ' - !+ " *& - )
Next 9' 3 )change
palteam_ps@yahoo.com !" # $ %#
Finish
PZ $ 9 % 3 2 ' #- 7 9 8 + ' + 5
palteam_ps@yahoo.com !" # $ %#
j2sedk 7 3 #
palteam_ps@yahoo.com !" # $ %#
: , ! " ' # %& " '
command )- >$ > )"' 9 5 - &) 8 + ' & D+ % & " '
: , ! F " 95 $ !
palteam_ps@yahoo.com !" # $ %#
' + 'd$ )c$ @ 2 " $ " 95 $ + %& " ' >
: d #
? c: K C4 ," ' A dZ- )
cd java- )
cd bin- )
: , !
palteam_ps@yahoo.com !" # $ %#
Java & #7 #
Z 3) ' $ ' " " " C $" ' + " " I' (# L 4 8 + '
import javax.swing.*;
import java.util.ArrayList;
int i = 1;
int c90 = 0, c80 = 0, c70 = 0, c60 = 0, failed = 0;
ArrayList<Integer> listC90 = new ArrayList<Integer>();
ArrayList<Integer> listC80 = new ArrayList<Integer>();
ArrayList<Integer> listC70 = new ArrayList<Integer>();
ArrayList<Integer> listC60 = new ArrayList<Integer>();
ArrayList<Integer> listFailed = new ArrayList<Integer>);
while(i != 0 ) {
String s = JOptionPane.showInputDialog("Enter number");
int x = Integer.parseInt(s);
if (x == 0)
i = 0;
if ( x >= 90 && x <= 100) {
listC90.add(x);
c90++;
} else if ( x >= 80 && x < 90) {
listC80.add(x);
c80 ++;
} else if ( x >= 70 && x < 80) {
listC70.add(x);
c70 ++;
} else if ( x >= 60 && x < 70) {
listC60.add(x);
c60 ++;
} else if ( x < 60) {
listFailed.add(x);
failed ++;
}
}
System.out.println("A "+ c90 + " - " + listC90);
System.out.println("B "+c80 + " - " + listC80);
System.out.println("C "+c70 + " - " + listC60);
System.out.println("D "+c60 + " - " + listC80);
System.out.println("F "+failed + " - " + listFailed);
}
}
palteam_ps@yahoo.com !" # $ %#
D3 # +/ &/ 0 2 # 2 H / ?
import javax.swing.JOptionPane;
sum=sum+i;
coun+=1;
}
avg=sum/coun;
String msg=String.format("the sum is:%d",sum);
String msg2=String.format("the Count is:%d",coun);
String msg3=String.format("the Average is:%f",avg);
JOptionPane.showMessageDialog(null,msg);
JOptionPane.showMessageDialog(null,msg2);
JOptionPane.showMessageDialog(null,msg3);
System.exit(0);
}
}
palteam_ps@yahoo.com = !" # $ %#
' - 7 ! "" $ 4"R ' 8 + ' - P)
PZ $4" "" $ ', ! " D # G B
import javax.swing.*;
class PrintOdd{
public static void main(String[] args){
String s = JOptionPane.showInputDialog("enter a positive integer");
int n = Integer.parseInt(s);
for(int i=0; i<=n; i++)
if(i%2 == 1)
System.out.println(i);
}}
- Person /+! / P)
?nameA ) ?idA # K4 $ •
G # ("' #"" ; 3# / •
K4 7 setName / •
class Person{
private int id;
private String name;
public Person(int id1, String
name1){
id = id1;
name = name1;
}
public void setName(String n){
name = n;
}
}
palteam_ps@yahoo.com !" # $ %#
W%45 I&8 Person S , T4$ UV % Employee S , 94 RQ
B#+ 0
\name[ ]' % \id[ #$ X )7 SY (Z •
salary IP 7 %
#$ L )4 #+^ 0! +) $ 0 . / 94 •
IP 4 % ]* %
;+0P >0 % getSalary #M$4_ 94 •
salary 4+E0 " ?
palteam_ps@yahoo.com !" # $ %#
olleH)B' Hello $ > A - '2 ' K+ $ 4"R '8 + '- )
import javax.swing.*;
class PrintInverse{
public static void main(String[] args){
String s = JOptionPane.showInputDialog("enter a sentence");
for(int i=s.length()-1; i>=0; i--)
System.out.print(s.charAt(i));
}}
palteam_ps@yahoo.com !" # $ %#
!
" # $ % !
$ &
palteam_ps@yahoo.com !" # $ %#