Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CPRG 215 Introduction to Object-Oriented Programming with Java Module 1-Introduction to Java Topic 1.1 Basics of Java Produced by Harvey Peters, 2008 Copyright SAIT Please read the following sections in your textbook Core Java, Volume I–Fundamentals, Eighth Edition (By Cay S. Horstmann & Gary Cornell) •Chapter 1 - An Introduction to Java •Java As a Programming Platform •The Java "White Paper" Buzzwords •Java Applets and the Internet •A Short History of Java •Common Misconceptions about Java CPRG 215 Module 1.2- Getting the Tools and Setting Up the Development Machine Copyright SAIT What is Java? • • • • • • • Object-oriented Distributed Portable/Architecture-neutral Reliable Secure Multi-threaded Dynamic – no link step - run-time flexibility CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.1 What is Java? • • • • Programming Language Development Environment Application Environment Deployment Environment CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.1 Characteristics of Java • Java is compiled to “bytecode” – Not binary like most compiled languages • Bytecode is interpreted by the Java Virtual Machine (JVM) • Performance – JVM is optimized -- speed approaching that of C++ • Optimization – JVM optimized for hardware and operating system • Portability – Java programs run on JVM, isolated from hardware & operating system – platform independent Topic 1.1.2 CPRG 215 Module 1.1- Basics of Java Copyright SAIT Java Compared to C++ • C++ – Performance • Used when high speed is required – Control • Tight control over memory usage • Java – Portability • Can run on any JVM (some version issues though) – Reliability • Exception handling reduces crashes – Security • Built-in security eliminates problems of other languages CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.3 JVM • • • • Java Program JVM O/S Java Virtual Machine (JVM) Layer between Java code and hardware Bytecode interpreter Can be software or can be built-in to the hardware • Part of the development tool or the Web browser • Buffer between program and platform – Platform independence Hardware CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.4 JVM • Bytecode – machine-code instructions – checked by compiler – must be able to run on any Java compliant interpreter CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.4 JVM • Garbage collection – memory allocated by assigning a pointer to the memory address – most languages require program to clean-up and free its memory when complete • leads to memory leaks if not handled correctly – Java automatically manages this CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.4 JVM • Security – Security Manager built into JVM – Provides cryptography, authentication & authorization, public key architecture – “customizable sandbox” • Security policy can be customized for finegrained control – Language security • • • • Strong data typing Automatic memory management Bytecode verification Secure class loading – Prevents memory violations, buffer overflows, and more CPRG 215 Module 1.1- Basics of Java Copyright SAIT Topic 1.1.4