10
CSCI 212 Object-Oriented Programming in Java

CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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

Page 1: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

CSCI 212Object-Oriented Programming

in Java

Page 2: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

Prerequisite: CSCI 111

variable assignment statementwhile loop for loop post-increment (i++) strong typing array block {} scopefunction parameter pre-increment (++i) recursion

Page 3: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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

Page 4: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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”

Page 5: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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

Page 6: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

Java Source Code

Java “Bytecode”

Java Compiler for Windows

HelloWorld.java

>javac HelloWorld.java

HelloWorld.class

>java HelloWorld

JRE

Page 7: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

Ada Source Code

Java “Bytecode”

Ada Compiler for Windows

Executable Binary Code for Windows

hardware

JRE

Page 8: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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!

Page 9: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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;

Page 10: CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing

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;