Академический Документы
Профессиональный Документы
Культура Документы
A interpreter actually does the same job as compiler except that the
job is done at the moment when the program is run
I We say, it does the job at run time
Question:
Compiled code can be executed faster! Why?
Rm 3521, desmond@cse.ust.hk COMP1022P (Spring 2017) 12 / 30
High-Level Languages
Briefing on Java
Java
I It is a name of an island of Indonesia
I It is also an informal name of a type
of brewed coffee :P
History:
I It is invented by a group people
working in Sun Microsystems in 1991
I One of the major contributor is James
Gosling
I Initially the language is named Oak.
Then it is changed to Java after
visiting a local coffee shop
I Now, it is one of the most important
general purpose OOP language
Java compiler
converts Java
program into
bytecode which is
platform independent
Java bytecode is
then interpreted and
translated by JI
(Java Interpreter) to
hardware-specific
machine code
JVM or VM = Java
Virtual Machine (It is
actually a program)
Two components.
http://www.oracle.com/
technetwork/java/javase/
downloads/
jdk8-downloads-2133151.
html
All these software are available at the download section of our course
website.
Rm 3521, desmond@cse.ust.hk COMP1022P (Spring 2017) 19 / 30
Development Cycle of a Java Program
3 Steps
1. Write Java source
code* using an editor
and save the code to a
file with extension
.java
2. Compile source file
(.java) into bytecode
file (.class) [ If any
syntax error, go back
to step 1! ]
3. Run the bytecode file
(i.e .class)
Then type:
javac WelcomeStudents.java
in the command prompt (where javac is
JDK Java compiler)
The compiler translates the Java source file ”WelcomeStudents.java” into
bytecode and saves it to the file ”WelcomeStudents.class”
Rm 3521, desmond@cse.ust.hk COMP1022P (Spring 2017) 23 / 30
My First Java Program (Cont’d)
Step 3: To run the byte code with the Java interpreter
Type:
java WelcomeStudents
where java is JDK Java interpreter
The cursor is moved to the beginning of the next line, since println is used.
It will be explained more in the next lecture!
Rm 3521, desmond@cse.ust.hk COMP1022P (Spring 2017) 24 / 30
Question
Algorithms Object-Oriented
Pseudo Code Programming
Computer Programs J2SE (Java 2 Standard
Edition)
Computer Programming
Bytecode
High Level Language
JI (Java Interpreter)
Assembly Language
JVM (Java Virtual Machine)
Machine Language
JIDE (Java Integrated
Compiler
Development Environment)
Interpreter
Case-Sensitive Language
Assembler
Procedural / Structured
Programming
Read the ”Guide about how to setup Eclipse for Java Developers” –
Available at our course website
https://course.cse.ust.hk/comp1022p/web_preview/
eclipse/index.html