2003 prentice hall, inc. all rights reserved. 1 java training course dr. h.e. dunsmore purdue...
TRANSCRIPT
2003 Prentice Hall, Inc. All rights reserved.
1
Java Training CourseDr. H.E. DunsmorePurdue University
Java – How to Program, Deitel (5th Edition)
2003 Prentice Hall, Inc. All rights reserved.
2
Chapter 1 – Introduction to Computers, the Internet, and the Web
Outline
1.8 History of Java1.9 Java Class Libraries1.13 Basics of a Typical Java Environment
2003 Prentice Hall, Inc. All rights reserved.
3
1.8 History of Java
• Java– 1991, Sun Microsystems Project Green (“Oak”)
– “Oak” became “Java”
– Originally for intelligent consumer-electronic devices
– Then used for creating Web pages with dynamic content
– Now also used for:
• Developing large-scale enterprise applications
• Enhancing Web server functionality
• Providing applications for consumer devices (cell phones, etc.)
2003 Prentice Hall, Inc. All rights reserved.
4
1.9 Java Class Libraries
• Classes– Include methods that perform tasks
• Return information after task completion
– Used to build Java programs
• Java contains class libraries– Known as Java APIs (Application Programming
Interfaces)
– Java finally has gotten us to the reality of “reusable code”
2003 Prentice Hall, Inc. All rights reserved.
5
1.13 Basics of a Typical Java Environment
• Java programs normally undergo five phases– Edit
• Programmer writes program (and stores program on disk)
• Java programs have .java extension• Editor can be simple text editor or Integrated
Development Environment (IDE)
– Compile• Compiler creates bytecode from program• Bytecode can be understood by a Java interpreter
(portability)• Bytecode is in a file with a .class extension
2003 Prentice Hall, Inc. All rights reserved.
6
1.13 Basics of a Typical Java Environment
• Java programs normally undergo five phases…– Load
• Class loader stores bytecode in memory
– Verify• Verifier ensures bytecode does not violate security
requirements• Security because Java frequently comes from
network
– Execute• Interpreter (Java Virtual Machine) translates
bytecode into machine language• Same process for both applications and applets
2003 Prentice Hall, Inc. All rights reserved.
7
Fig. 1.1 Typical Java environment.
PrimaryMemory
.
.
.
.
.
.
Disk
Disk
Disk
Editor
Compiler
Class Loader
Program is created in an editor and stored on disk in a file ending with .java.
Compiler creates bytecodes and stores them on disk in a file ending with .class.
Class loader reads .class files containing bytecodes from disk and puts those bytecodes in memory.
Phase 1
Phase 2
Phase 3
PrimaryMemory
.
.
.
.
.
.
Bytecode Verifier Bytecode verifier
confirms that all bytecodes are valid and do not violate Java’s security restrictions.
Phase 4
PrimaryMemory
.
.
.
.
.
.
InterpreterInterpreter reads bytecodes and translates them into a language that the computer can understand, possibly storing data values as the program executes.
Phase 5