Sie sind auf Seite 1von 18

1

Introduction to
Introduction to
Java
Java
Sang Shin
Sang Shin
Michle Garoche
Michle Garoche
www.javapassion.com
www.javapassion.com

Learn with Passion!


Learn with Passion!
1
2
Objectives
At the end of the lesson, the student should be able
to:

Describe the features of Java technology such as


the Java virtual machine (JVM), garbage collection
(GC) and code security

Describe the different hases of a Java rogram


3
Java Background: History

Java

!as created in "##"

by James Gosling et al$ of %un Microsystems$

&nitially called 'a(, in honor of the tree outside Gosling)s


!indo!, its name !as changed to Java because there !as
already a language called 'a($
4
Java Background: History

Java

*he original motivation for Java

*he need for latform indeendent language that could be


embedded in various consumer electronic roducts li(e toasters
and refrigerators$

'ne of the first ro+ects develoed using Java

a ersonal hand,held remote control named %tar -$

At about the same time, the .orld .ide .eb and the &nternet
!ere gaining oularity$ Gosling et$ al$ reali/ed that Java could
be used for &nternet rogramming$
5
Java Background:
What is Java Technology?

*he Java technology is:

A rogramming language

A develoment environment

An alication environment

A deloyment environment
6
Java Technology: Programming
anguage

As a rogramming language, Java can create all


(inds of alications that you could create using
any conventional rogramming language$
7
Java Technology:
! "evelo#ment $nvironment

As a develoment environment, Java technology


rovides you !ith a large suite of tools:

A comiler (+avac)

An interreter (+ava)

A documentation generator (+avadoc)

A class file ac(aging tool


and so on$$$
8
Java Technology:
!n !##lication and %untime $nvironment

Java technology alications are tyically general,


urose rograms that run on any machine !here
the Java runtime environment (J01) is installed$

*here are t!o main deloyment environments:


"$ *he J01 sulied by the Java 2 %oft!are Develoment 3it (%D3)
contains the comlete set of class files for all the Java technology
ac(ages, !hich includes basic language classes, G4& comonent
classes, and so on$
2$ *he other main deloyment environment is on your !eb bro!ser$
Most commercial bro!sers suly a Java technology interreter and
runtime environment$
9
Java &eatures

%ome features of Java:

*he Java Virtual Machine

Garbage Collection

Code %ecurity
10
Java &eatures:
The Java 'irtual (achine

Java Virtual Machine (JVM)

an imaginary machine that is imlemented by emulating soft!are on a real


machine

rovides the hard!are latform secifications to !hich you comile all Java
technology code

5ytecode

a secial machine language that can be understood by the Java Virtual


Machine (JVM)

indeendent of any articular comuter hard!are, so any comuter !ith a


Java interreter can e6ecute the comiled Java rogram, no matter !hat
tye of comuter the rogram !as comiled on
11
Java &eatures:
)arbage *ollection

Garbage collection thread

resonsible for freeing any memory that can be freed$


*his haens automatically during the lifetime of the
Java rogram$

rogrammer is freed from the burden of having to deallocate that


memory themselves
12
Java &eatures:
*ode +ecurity

Code security is attained in Java through the


imlementation of its Java 0untime 1nvironment
(J01)$

J01

runs code comiled for a JVM and erforms class


loading (through the class loader), code verification
(through the bytecode verifier) and finally code e6ecution
13
Java &eatures:
*ode +ecurity

Class 7oader

resonsible for loading all classes needed for the Java


rogram

adds security by searating the namesaces for the


classes of the local file system from those that are
imorted from net!or( sources

After loading all the classes, the memory layout of the


e6ecutable is then determined$ *his adds rotection
against unauthori/ed access to restricted areas of the
code since the memory layout is determined during
runtime
14
Java &eatures:
*ode +ecurity

5ytecode verifier

tests the format of the code fragments and chec(s the


code fragments for illegal code that can violate access
rights to ob+ects
15
Phases o, a Java Program

*he follo!ing figure describes the rocess of


comiling and e6ecuting a Java rogram
16
Phases o, a Java Program
17
+ummary

Java 5ac(ground

8istory

Java *echnology

A rogramming language, develoment environment,


alication environment and deloyment environment

Java 9eatures

Java Virtual machine, garbage collection and code security

:hases of a Java :rogram

.rite, comile, run


18


Thank you-
Thank you-
Check JavaPassion.com Coecamps!
Check JavaPassion.com Coecamps!
http!""www.javapassion.com"coecamps
http!""www.javapassion.com"coecamps

Learn with Passion!


Learn with Passion!
18

Das könnte Ihnen auch gefallen