by: cheryl mok & sarah tan. java is partially interpreted. 1. programmer writes a program in...

6
By: Cheryl Mok & Sarah Tan

Upload: pauline-whitehead

Post on 21-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual

By: Cheryl Mok & Sarah Tan

Page 2: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual
Page 3: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual

Java is partially interpreted.

1. Programmer writes a program in textual form

2. Runs the compiler, which converts the textual form into byte-code (an intermediate language)

3. The byte-code file is then run over an interpreter, which executes the native machine code

instructions corresponding to each instruction in byte-code.

Page 4: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual

Java is system independent since it is partially interpreted.

The compiled byte-code is transferable to any system with a

byte-code interpreter.

Page 5: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual

• responsible for interpreting Java bytecode• translating this into actions or operating system calls• Examples:

• a request to establish a socket connection to a remote machine will involve an operating system call.

• Different operating systems handle sockets in different ways - but the programmer doesn't need to worry about such details. •the responsibility of the JVM to handle those translations, so that the operating system and CPU architecture on which Java software is running is completely irrelevant to the developer.

Page 6: By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual

The .class files generated by the compiler are not executable binaries so Java combines compilation and

interpretation Instead, they contain “byte-codes” to

be executed by the Java Virtual Machine other languages have done this, e.g. UCSD

PascalThis approach provides platform

independence, and greater security