Professional Documents
Culture Documents
Java I Lecture 1
Java I Lecture 1
Chapter 1
Introduction to Computers,
the Internet and the Web
After his stint at Sun, Mr. Naughton went on to work for Disney and, temporarily, for the FBI.
Sun.
Pat was going to join NeXT,
because Sun was a mess.
McNealy asked Pat to write a
memo outlining his gripes.
Technically, Java still has pointers but they are called references and cannot be used to do
pointer arithmetic or any of the other shenanigans that make C programming such a joy.
Javas
Major Advantage
over C & C++
Java is C without
the Guns and
Knives.
Java I--Copyright 2000-2007 Tom Hunter
Java Architecture
By now, Java itself has matured into its 7th
version, named Java 7.
Java is Object-Oriented*--that means
everything in the language behaves like an
object.
What exactly that means will be explained
in the coming lectures.
* Purists
will say the presence of primitive variables makes this only 99.9% true.
Java Architecture
Java Architecture
Java Architecture
Java Architecture
Java
Compiler
Hello.java
Java
Virtual
Machine
Run-Time
Environment
Java Architecture
Java Architecture
What is the
Java
Virtual
Machine
C Source Code
C object module
compiled into
machine language
Java Architecture
Java bytecode
In contrast to conventional programming
languages, a Java program is not compiled
into native machine language.
Instead, Java makes bytecode.
Bytecode is the result of a compile, but
the compile results in an intermediate form
that stops short of native machine-specific
code.
Java Architecture
Java Architecture
Java Architecture
Write Once,
Run Anywhere.
Java I--Copyright 2000-2007 Tom Hunter
Java Source
The
bytecode
is met
half-way
by the
JVM.
JVM-Win
JVM-Mac
JVM-Unix
JVM-IBM
Wintel
Mac
UNIX
MVS
Java Architecture
Remote Code
Local Code
All Code, both Local and Remote, Must Pass Security Policy
JDK 1.2
Security Model
SANDBOX
Objects in Java
In Java, Object Orientation is so
pervasive that its nearly impossible to
write a strictly procedural program in
the language.
Objects in Java
Objects in Java
Objects in Java
Objects in Java
is called a class.
Objects in Java
Objects in Java
javac
C:\javac Hello.java
Applications
Applets
Java I--Copyright 2000-2007 Tom Hunter
A Java Application
// HelloWorld.java Our first Java Application
public class HelloWorld
{
public static void main( String args[])
{
System.out.println( Hello World! );
}
}
A Java Application
// HelloWorld.java Our first Java Application
public class HelloWorld
{
public static void main( String args[])
{
System.out.println( Hello World! );
}
}
A Java Application
// HelloWorld.java Our first Java Application
public class HelloWorld
{
public static void main( String args[])
{
System.out.println( Hello World! );
}
}
A Java Application
C:\>javac HelloWorld.java
C:\>
A Java Application
C:\>javac HelloWorld.java
C:\>java HelloWorld
Hello World!
In Class Activity
Now load the JDK. I recommend using th
most current one.