Upload
aubrey-fields
View
216
Download
0
Embed Size (px)
DESCRIPTION
Why Java? Write Once; Run Anywhere? C++ Source Code Executable Binary Code for Windows hardware C++ Compiler for Windows C++ Compiler for iOS Executable Binary Code for Apple hardware Executable Binary Code for other hardware C++ Compiler for other hardware
Citation preview
CSCI 212Object-Oriented Programming
in Java
Prerequisite: CSCI 111
variable assignment statementwhile loop for loop post-increment (i++) strong typing array block {} scopefunction parameter pre-increment (++i) recursion
Why Java?Write Once; Run Anywhere?
C++ Source Code
Executable Binary Code for Windows
hardware
C++ Compiler for Windows
C++ Compiler for iOS
Executable Binary Code for Apple hardware
Executable Binary Code for other hardware
C++ Compiler for other hardware
Write Once; Run Anywhere!
Java Source Code
Java “Bytecode”
Java Compiler for Windows
Java Compiler for iOS
Java “Bytecode” Java “Bytecode”
Java Compiler for other hardware
Java Virtual Machine“JVM”
Java Virtual Machine“JVM”
Java Virtual Machine“JVM”
The JDK and the JREAPI – Application Program Interface
Class libraries (MATH, GUI, Database…)
JRE – Java Runtime EnvironmentJVM plus API (can run Java programs)
JDK- Java Development KitJRE plus compiler, javadoc, …
For CSCI 212 you need the JDK
Java Source Code
Java “Bytecode”
Java Compiler for Windows
HelloWorld.java
>javac HelloWorld.java
HelloWorld.class
>java HelloWorld
JRE
Ada Source Code
Java “Bytecode”
Ada Compiler for Windows
Executable Binary Code for Windows
hardware
JRE
The Java Virtual Machine ensures a program will run the same way on any computer
My biggest integer is 999,999,999,999,999,999!
My biggest integer is 999,999,999!
When running on Native Hardware you are dependent on the machine's architecture
My biggest integer is 999,999,999,999,999,999!
My biggest integer is 999,999,999!
int salary = 999,999,999,999,999,999;
The JVM Levels the Playing Field
My biggest integer is 999,999,999,999,999,999!
My biggest integer is 999,999,999!
int salary = 999,999,999,999,999,999;
JVMThe biggest Java integer is 2,147,483,647
int salary = 1,999,999,999;