CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language:...
-
Upload
robert-farmer -
Category
Documents
-
view
213 -
download
0
Transcript of CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language:...
![Page 1: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/1.jpg)
CSCI 224
Introduction to Java Programming
![Page 2: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/2.jpg)
Course Objectives
Learn the Java programming language: Syntax, Idioms Patterns, Styles
Become comfortable with OOP Learning to think in objects
Learn the essentials of the Java class library And how to learn about other parts when you
need them
![Page 3: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/3.jpg)
Writing Code
It is not enough to write code that works.
It is important to write code that is also Legible, Maintainable,
Reusable, Fast and Efficient
![Page 4: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/4.jpg)
Java
Sun defines Java as a: “…simple, object-oriented, network
savvy, interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded, dynamic language.”
![Page 5: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/5.jpg)
What is Java?
History of Java First started in 1990 as Sun’s Green project
Digitally controlled consumer devices identified as trend
Trend did not grow as expected 1994 – WWW popularity Netscape packaged Java within browser
- MS Explorer followed suit Success ultimately depended on e-commerce
![Page 6: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/6.jpg)
What is Java
Java is a high level,third generation programming language
Compared to other languages it is most similar to C and shares much of the syntax Unlike C++ Java is not a superset of C
and substantial amounts of C code would need to be reworked to become a Java program
![Page 7: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/7.jpg)
Java is :
A Platform Simple Object-Oriented Platform independent Safe High Performance Multi-Threaded Garbage Collected
![Page 8: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/8.jpg)
Platform
Three elements to Java The programing language The compiler The Java interpreter
The Java compiler creates byte code and not code native to particular platform. The result is that the JVM the runtime machine interprets this code on the fly and translates it to the machine.
![Page 9: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/9.jpg)
Simple
Java is designed to be easy to write. Not a lot of special tricks to confuse
beginners Memory allocation and deallocation are
handled automatically. Syntax is straight forward in most
situations.
![Page 10: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/10.jpg)
Object Oriented
The core concept of Java Everything is an object. Huge libraries of objects are available.
Learning to use the API is essential
![Page 11: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/11.jpg)
Platform independent
The Java byte code is never really executed on the host machine.
Each JRE / JVM does all the work of interfacing with the OS and machine.
Also eliminates having to deal with variations in platform architecture Integer is always four bytes.
![Page 12: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/12.jpg)
Safe
Java was designed from the ground up to allow for execution across a network.
Applets – executed with set limitations on what they can do to within your system. Essentially they run in a sandbox.
![Page 13: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/13.jpg)
High Performance
The Java byte code compiles on the fly with speeds that rival the C++ compiler.
![Page 14: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/14.jpg)
Multi-Threaded
Java is inherently multi-threaded allowing a single program to execute different processes independently and continuously.
The is a cost to this for the programmer. Just as in C pointer arithmetic can be hard to debug, debugging threads is a challenge.
![Page 15: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/15.jpg)
Garbage Collection
There is no need to explicitely allocate or de-allocate memory in Java.
No need to write destructor methods. The JRE handles the trash.
![Page 16: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/16.jpg)
Practical
What do you need to run Java. JDK – Java developer's Kit. JRE – Java Runtime Enviroment SDK – Java Software Development Kit
IDEs Several development tools exist.
The most basic thing you need is Notepad or any text editor to write the java source files.
Jbuilder, Sun's One Studio , JCreator, Forte and Eclipse are just a few.
![Page 17: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/17.jpg)
Development Tools
1995 – First JDK released by Sun (1.0) Very limited
JDK 1.1 released Limited GUI creation
1.2 released Major change – Swing components Java 2 SDK release 1.2 Better known as Java 2
Most current version: 1.5
![Page 18: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/18.jpg)
Development Tools
Java 2 Editions Java 2 Platform, Standard Edition Java 2 Platform, Enterprise Edition Java 2 Platform, Micro Edition
![Page 19: CSCI 224 Introduction to Java Programming. Course Objectives Learn the Java programming language: Syntax, Idioms Patterns, Styles Become comfortable.](https://reader036.fdocuments.in/reader036/viewer/2022082817/56649e225503460f94b0fdd8/html5/thumbnails/19.jpg)
Java Programs
Applets Java program running within client Web
browser Servlet
Java program running on a server Can ‘cooperate’ with applet or
application Application
Standalone program