LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.

16
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING

Transcript of LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.

LESSON 1INTRODUCTION

Compiled By: Edwin O. Okech [Tutor, Amoud University]

JAVA PROGRAMMING

Outline

Compiled By: Edwin O. Okech [Tutor, Amoud University]

The origin of Java. The Java history. The capabilities of Java programming

language. The Java language specifications The Java API The Java development toolsHow does byte code makes Java a portablelanguage?

Origin of Java

Compiled By: Edwin O. Okech [Tutor, Amoud University]

In 1991, Java was developed by a team led by James

Gosling and Patrick Naughton at Sun Microsystems.

Originally named Oak ‐ Gosling liked the look of an oak tree that was outside his window at Sun.

History of Java

Compiled By: Edwin O. Okech [Tutor, Amoud University]

The challenge: For use in embedded consumer electronic appliances ‐ the cable TV switchboxes.Different manufacturers may choose different

central processing units (CPUs).The cable TV switchboxes devices do not

have a lot of power or memory.The language;

Had to be small and generate very tight code.

Not be tied to any single architecture.

History of Java

Compiled By: Edwin O. Okech [Tutor, Amoud University]

A two‐step Java translation process have been developed:Programs written in Java were translated into an

intermediate language, known the byte code.Then, the byte code would be translated into

machine language.In 1994, Java was used to develop a Web browser,

named HotJava.The browser able to download and run small Java

programs over the internet, known as the applets.Capable to display animation and interact with the

user.In 1995, Netscape incorporated Java technology into its

Netscape browser.Then, other Internet companies followed . . .

Java Capabilities

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Java is a full‐featured and general‐purpose programming language that is capable of developing a robust mission‐critical applications for:DesktopsServersMobile devices

The Java programming language is a relatively highlevel language, class‐based and object‐oriented.

Java Capabilities

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Java running on the desktop is called application.

Java running on the Internet is called applets.

Java developed on the server‐side is called servlet.

Java Language Specification

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Defines the Java standard and the technical definition of the language.includes the syntax and semantics of the

language.url: java.sun.com/docs/books/jls

Java Application Programming Interface

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Java application program interface (API) contains the predefined classes and interfaces for developing

Java programs.In 1995, Java 1.0 was introduced.

With 211 classes and interfaces.In December 1998, Java 2 platform was

announced.Applies to current Java technology.

Java API

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Java API

Compiled By: Edwin O. Okech [Tutor, Amoud University]

There are 3 editions of the Java API:Java 2 standard edition (J2SE)

Client‐side standalone applications or applets.Java 2 Enterprise Edition (J2EE)

Server‐side applications, such as Java servlets and JavaServer Pages.

Java 2 Micro Edition (J2ME) Mobile devices, such as cell phones or pda.

Demonstrate how to link to JavaAPI

Compiled By: Edwin O. Okech [Tutor, Amoud University]

J2SE versions and JDKThere are many versions of J2SE.

Sun releases each version of J2SE with a Java Development toolkit (JDK).

JDK consists of a set of separate programs for developing and testing Java programs.Each of which is invoked from a command line.

For J2SE 5.0, the Java development toolkit is called JDK 5 – formerly was known as JDK1.5.The latest version is J2SE 6.

Java Development Tools

Compiled By: Edwin O. Okech [Tutor, Amoud University]

A software that provides an integrated development environment (IDE) for rapidly developing Java programs.

Java development tools on the market:NetBeans by Sun (open source)JBuilder by BorlandEclipse by IBM (open source)

Other useful tools:Code warrior by MetroworksTextPad EditorJCreator LEJeditBlueJ

Byte-code The Java Virtual Machine

Compiled By: Edwin O. Okech [Tutor, Amoud University]

The Java compiler translates Java programs into byte‐code.Once compiled to byte‐code, a Java program

can be used on any computer, making it very portable machine.

The Java Virtual Machine (JVM) translates the byte code into machine language.

Portable

Compiled By: Edwin O. Okech [Tutor, Amoud University]

Portable means that a program may be written on one type of computer and then run on a wide variety of computers, with little or no modification.

Java byte code runs on the JVM and not on any particular CPU; therefore, compiled Java programs are highly portable.

JVMs exist on many platforms:WindowsMacintoshLinux

Portability

Compiled By: Edwin O. Okech [Tutor, Amoud University]

PortabilityByte Code

JVM For Window

s

JVM For Linux

JVM For Macinto

sh

JVM For Unix