372x Filetype PDF File size 1.77 MB Source: www.cs.drexel.edu
Introduction to Java
Material drawn from [Lewis01, Kjell00, Mancoridis01]
Java Basics
Java
Developed by James Gosling at Sun
Microsystems.
Introduced in 1995.
Is one the fastest growing programming
technologies of all time.
Java 1
Bytecode
Java programs are translated into an intermediate
language called bytecode.
Bytecode is the same no matter which computer
platform it is run on.
Bytecode is translated into native code that the
computer can execute on a program called the
Java Virtual Machine (JVM).
The Bytecode can be executed on any computer
that has the JVM. Hence Java’s slogan, “Write
once, run anywhere”.
The Java Environment
Runs on
Windows PC
Code Compile Result Running JVM
Java Program Java Compiler Java Bytecode UNIX
(*.java) javac (*.class) Running JVM
Macintosh
Running JVM
Installing Java
The Java Development Kit (JDK) is a
collection of software available at no charge
from Sun Microsystems, Inc. The v1.3
download is available at java.sun.com.
Java 2
Sample Java Program
class Hello {
public static void main ( String[] args ) {
System.out.println("Hello World!");
}
}
Try it yourself (Start a Notepad)
Notepad
Java 3
Save the Source File
Name the File
Open a Command Interpreter
Window
1.Start up the DOS command prompt
2.Under the system prompt type cd \temp to get to the
directory where you saved Hello.java
3. Type command dir, to list the files under the
directory. You should see Hello.java
Java 4
no reviews yet
Please Login to review.