Teach Yourself Java in 21 Days



Download 5,76 Mb.
Pdf ko'rish
bet45/54
Sana30.12.2021
Hajmi5,76 Mb.
#97759
1   ...   41   42   43   44   45   46   47   48   ...   54
Bog'liq
LearnJava

NEW

TERM



NEW



TERM

030-4s CH01.i



1/29/96, 8:35 PM

7



8

An Introduction to Java Programming

M

T

W

R

F

S

S

DAY

DAY

1

P2/V4sqc7    TY  Java in 21 Days   030-4  sdv   12.22.95    Ch01   LP#4

To run a Java program, you run a program called a bytecode interpreter, which in turn executes

your Java program (see Figure 1.3). You can either run the interpreter by itself, or—for applets—

there is a bytecode interpreter built into HotJava and other Java-capable browsers that runs the

applet for you.



Figure 1.2.

Traditional compiled

programs.

Your Code

Compiler (Pentium)

Binary File

(Pentium)

Binary File

(PowerPC)

Binary File

(SPARC)

Compiler (PowerPC)

Compiler (SPARC)

Figure 1.3.

Java programs.

Java Code

Java Compiler

(Pentium)

Java Bytecode

(Platform-

Independent)

Java Compiler

(PowerPC)

Java Compiler

(SPARC)

Java Interpreter

(Pentium)

Java Interpreter

(PowerPC)

Java Interpreter

(SPARC)

Window


Window

Window


030-4s CH01.i

1/29/96, 8:35 PM

8



9

Sams.net Learning Center

abcd


1

P2/V4sqc7    TY  Java in 21 Days   030-4  sdv   12.22.95    Ch01   LP#4

Why go through all the trouble of adding this extra layer of the bytecode interpreter? Having

your Java programs in bytecode form means that instead of being specific to any one system, your

programs can be run on any platform and any operating or window system as long as the Java

interpreter is available. This capability of a single binary file to be executable across platforms

is crucial to what enables applets to work, because the World Wide Web itself is also platform-

independent. Just as HTML files can be read on any platform, so applets can be executed on any

platform that is a Java-capable browser.

The disadvantage of using bytecodes is in execution speed. Because system-specific programs

run directly on the hardware for which they are compiled, they run significantly faster than Java

bytecodes, which must be processed by the interpreter. For many Java programs, the speed may

not be an issue. If you write programs that require more execution speed than the Java interpreter

can provide, you have several solutions available to you, including being able to link native code

into your Java program or using tools to convert your Java bytecodes into native code. Note that

by using any of these solutions, you lose the portability that Java bytecodes provide. You’ll learn

about each of these mechanisms on Day 20.


Download 5,76 Mb.

Do'stlaringiz bilan baham:
1   ...   41   42   43   44   45   46   47   48   ...   54




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish