Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

21
Why Java? A brief introduction to Java and its features Prepared by Mithat Konar

Transcript of Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Page 1: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Why Java?

A brief introduction to Java and its features

Prepared by Mithat Konar

Page 2: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java is…

A general purpose, high-level programming language with support for object-oriented programming.

A collection of wide-ranging application programming interfaces (APIs).

A self-contained runtime system. A complete set of development tools.

Page 3: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java is not…

An internet-only programming language. Difficult. JavaScript.

Page 4: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java’s Main Features

Uses virtual machine model to assure true “write once, run anywhere” programs.

Built-in support for GUIs. Built-in networking. Built-in security features. Built-in support for multi-threaded

programming. Self-documenting.

Page 5: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java applications

Applets Stand-alone programs Network servers Network clients Embedded designs

Mobile telephones Portable Digital Assistants (PDAs) Set-top boxes Digital Signal Processing (DSP)

Page 6: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Virtual Machine

The conventional compiled-code model

source code compiler/linker

object code (native)

object code

Microprocessor system

Page 7: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Virtual Machine

The virtual machine model

source code compiler/linker

bytecode

bytecode

Microprocessor system

Java Virtual Machine

Page 8: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Virtual MachineAdvantages Compiled bytecode can run without

modification on any platform that has a Java Virtual Machine.

“Compile once, run anywhere”.

Page 9: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Virtual Machine Disadvantages Compiled bytecode runs a little slower than

conventional compiled code. Advances in JVM technology are closing the

gap. Not all low-level system manipulations are

available through standard Java APIs. Low-level system manipulations are available

in the form of native (non-Java) extensions.

Page 10: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Language Features

Syntax is similar to C++. Full support for OOP

Classes and objects Information hiding/access control Inheritance, method overriding Polymorphism Abstract methods and classes Interfaces

Page 11: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java Language Features

Everything that is not a primitive is an object. No pointers! Objects are accessed through

reference variables. Built-in memory management and garbage

collection.

Page 12: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java API Features

Support for the essentials Classes and objects I/O Threads

Applet support Conventions used by applets

Page 13: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java API Features

Graphic User Interface (GUI) support Abstract Windowing Toolkit (AWT)

Windows, dialogs, file dialogs Buttons, checkboxes Menus, menu bars Scrollbars etc.

New generation GUI toolkit: Swing All the above, plus... Platform independent and run-time changeable

look-and-feel. And more.

Page 14: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java API Features

Networking TCP/IP UDP URLs

Internationalization Programs can automatically adapt to specific

locales and be displayed in the appropriate language.

Page 15: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java API Features

Security Electronic signatures Public and private key management Access control Certificates

Java Database Connectivity (JDBCTM) Provides uniform access to a wide range of

relational databases.

Page 16: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Java API Features

The Java platform also has APIs for 2D and 3D graphics Accessibility Servers Collaboration Telephony Speech Animation and more.

Page 17: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Benefits of Programming in Java

Get started quicklyAlthough the Java programming language is a powerful object-oriented language, it's easy to learn, especially for programmers already familiar with C or C++.

Write less codeComparisons of program metrics suggest that a program written in the Java programming language can be four times smaller than the same program in C++.

Page 18: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Benefits of Programming in Java

Write better code The Java programming language encourages

good coding practices. Garbage collection helps you avoid memory

leaks. Its object orientation and wide-ranging, easily

extendible API let you reuse other people's tested code and introduce fewer bugs.

Page 19: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Benefits of Programming in Java

Develop programs fasterDevelopment time may be as much as twice as fast compared to writing the same program in C++ because you write fewer lines of code and it is a simpler programming language than C++.

Page 20: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Benefits of Programming in Java

Avoid platform dependencies.You can keep your program portable by avoiding the use of libraries written in other languages and native methods.

Write once, run anywhere.Because 100% pure Java programs are compiled into machine-independent bytecodes, they run consistently on any Java platform.

Page 21: Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.

Benefits of Programming in Java

Distribute software more easily.Upgrade applets easily from a central server. Applets take advantage of the feature of allowing new classes to be loaded "on the fly," without recompiling the entire program.