Anda di halaman 1dari 24

JAVA FUNDAMENTALS

Java

Object Oriented language

Developed by Sun Microyte! in "##"

Originally called Oa$ by Ja!e %oling


Java History:
Year Progress
1990 Sun decided to developed software
that could be used for electronic
devices. And the project called as
Green Project head by Jaes
Goslin!.
1991 Announceent of a new lan!ua!e
naed " #$a%&
199' (he tea verified the application of
their new lan!ua!e to ana!e a
list of hoe appliances usin! a
hand held device.
199) (he *orld *ide *eb appeared on
the +nternet and transfored the
te,t"based interface to a !raphical
rich environent.
Java History (Contd.)
Year Progress
199- (he tea developed a new *eb
browsed called " #.ot Java# to
locate and run Applets.
199/ $a% was renaed to Java0 as it did
not survive 1 le!al re!istration.
2any copanies such as
3etscape and 2icrosoft
announced their support for Java.
1994 Sun releases Java 5evelopent
6it7J56 1.08
1999 Sun releases Java 5evelopent
6it7J56 1.18
Year Progress
199: Sun releases Software
5evelopent 6it 7S56 1.'8
1999 Sun releases Java ' platfor
Standard ;dition 7J'S;8 and
;nterprise ;dition7J';;8.
'000 J'S; with J56 1.) was released
'00' J'S; with J56 1.) was released
'00- J'S; with J56 /.0 was released
Java History (Contd.)
Year Progress
'004 J'S; with J56 4.0 was released
'010 $racle buys java
'011 J'S; with J56 9.0 was released
'01- J'S; with J56 :.0 was released
Java History (Contd.)
Features of Java :
&
'o!piled and (nterpreted
&
)lat*or! (ndependent and
portable
&
Object+ oriented
&
,obut and ecure
&
Ditributed
&
Fa!iliar- i!ple and !all
&
Multit.readed and (nteractive
&
/ig. per*or!ance
&
Dyna!ic and E0tenible
Comparison in Java and C++
Java '11
" Java i true Object+oriented
language
'11 i baically ' 2it.
Object+oriented e0tenion
3 Java doe not upport operator
overloading4
'11 upport operator
overloading4
5 Java doe not .ave te!plate
clae a in '11
'11 .a te!plate
clae4
6 Java doe not upport !ultiple
in.eritance o* clae but it
upport inter*ace
'11 upport !ultiple
in.eritance o* clae4
7 Java co!piled into byte code *or t.e
Java Virtual Mac.ine4 T.e ource code
i independent on operating yte!4
Source code can be 2ritten to be
plat*or! independent and 2ritten to
ta$e advantage o* plat*or!
'11 typically
co!piled into
!ac.ine code
8 ,un in a protected virtual !ac.ine E0poe lo2+level
yte! *acilitie4
9 Java doe not upport global variable4
Every variable .ould declare in cla
'11 upport global
variable4
: Java doe not ue pointer '11 ue pointer
Comparison in Java and C++
(Contd.)
(he Java technolo!y architecture uses
the followin! features to fulfill its !oals<
(he Java =irtual 2achine 7J=28
Garba!e collection
(he Java >untie ;nvironent 7J>;8
J=2 tool interface
T.e JVM peci;cation provide t.e .ard2are
plat*or! peci;cation to 2.ic. you co!pile all Java
tec.nology code4
T.i peci;cation enable t.e Java o*t2are to be
plat*or!+independent becaue t.e co!pilation i
done *or a generic !ac.ine- $no2n a t.e JVM4
T.e co!piler ta$e t.e Java application ource code
and generate bytecode4
<ytecode are !ac.ine code intruction *or t.e
JVM4
Java Virtual Machine
T.e Java Virtual Mac.ine ='ontd4>
JVM provide de;nition *or t.e?
(ntruction et
,egiter et
'la ;le *or!at
,unti!e tac$
%arbage+collected .eap
Me!ory area
Fatal error reporting !ec.ani!
/ig.+preciion ti!ing upport
Garba!e collection<
?hec%s and frees eory that is no lon!er needed.
Provides a syste"level thread to trac% eory
allocation.
.appens autoatically durin! the lifetie of a Java
pro!ra.
T.e *ollo2ing ;gure diplay t.e operation o* t.e
J,E4
JVM@ Ta$
T.e !ain ta$ per*or!ed by t.e JVM are?
Loading? (t i per*or!ed by t.e cla
loader to load t.e code4
Veri*ying? (t i per*or!ed by t.e bytecode
veri;er to veri*y t.e code4
E0ecuting? (t i per*or!ed by t.e runti!e
interpreter to e0ecute t.e code4
Paca!e

is a naespace that or!ani@es a set of


related classes and interfaces

are used in Java in order to prevent


nain! conflicts0 to control access0 to
a%e searchin!Alocatin! and usa!e of
classes0 interfaces0 enuerations and
annotations easier0 etc

e!. for pac%a!es java.util 0 java.io

Synta, for creatin! pac%a!e


pac%a!e Bpac%a!e naeCD
Data Types

(he various data types in Java are<

Priitive or the siple data types

Abstract or the derived data types


Group Data
Type
Size Range Default
Value
Integer byte One byte -128 to 127 0
short Two byte -32,768 to 32,767 0
int Four byte -2,17,83,68 to
2,17,83,67
0
!ong "ight byte -#,223,372,036,8$,
77$,808 to
#,223,372, 036,
8$,77$,807
0
Priitive 5ata (ypes
Group Data
Type
Size Range Default
Value
F!oating point %!oat Four byte 3&e-038 to
3&e'038
0&0
(oub!e "ight byte 1&7e-308 to
1&7e'308
0&0
)oo!ean boo!ean One bit true or %a!se %a!se
*hara+ter +har Two byte a sing!e +hara+ter nu!!
Data Types ,*ont(&-

Abstract data types<

5ata types derived fro the priitive data types

Strin! stores letters0 di!its0 and characters such as as A0


780 <0 <0 E0 and F.
Di%%erent Types O% .ariab!es

(ypes of =ariables<

+nstance variables

Gocal variables

Static variables

Autoatic variables
/++ess 0pe+i%iers in 1a2a
=ariables and ethods can be at one of four access levels<
public
protected
default
private
(he followin! fi!ure displays the various access levels used
in Java.

Anda mungkin juga menyukai