18
Introduction to Java Programming Language By Norazah Yusof Software Engineering Department F lt f C t Si d I f ti S t Faculty of Computer Science and Information Systems 1

Introduction to Java Programming Language

Embed Size (px)

DESCRIPTION

Lecture notes

Citation preview

Page 1: Introduction to Java Programming Language

Introduction to Java Programming Language

By

Norazah YusofSoftware Engineering Department

F lt f C t S i d I f ti S tFaculty of Computer Science and Information Systems

1

Page 2: Introduction to Java Programming Language

OutlineOutline

The origin of Java.

The Java history.The Java history.

The capabilities of Java programming language.

The Java language specificationsThe Java language specifications

The Java API

The Java development toolsThe Java development tools

How does byte code makes Java a portable language?language?

2

Page 3: Introduction to Java Programming Language

Origin of Java

I 1991 J d l d b t l d b J

Origin of Java

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 ofOriginally named Oak ‐ Gosling liked the look of an oak tree that was outside his window at Sun.

3

Page 4: Introduction to Java Programming Language

History of Java

Th h ll F i b dd d

History of Java

The challenge: For use in embedded consumer electronic appliances ‐ the cable TV switchboxes.

Different manufacturers may choose different centralDifferent 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.

4

Page 5: Introduction to Java Programming Language

History of JavaHistory of Java

A two‐step Java translation process have been developed:

Programs written in Java were translated into an intermediate language, known the byte code.

Th th b t d ld b t l t d i t hiThen, the byte code would be translated into machine language.

5

Page 6: Introduction to Java Programming Language

History of Java

I 1994 J d t d l W b b

History of Java

In 1994, Java was used to develop a Web browser, named HotJava.

The browser able to download and run small JavaThe 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 . . .

6

Page 7: Introduction to Java Programming Language

Java Capabilities

J i f ll f t d d l

Java Capabilities

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

Desktops

Servers

Mobile devices

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

7

Page 8: Introduction to Java Programming Language

Java CapabilitiesJava Capabilities

Java running on the desktop is called application.

Java running on the Internet is called appletsJava running on the Internet is called applets.

Java developed on the server‐side is called servlet.

8

Page 9: Introduction to Java Programming Language

Java Language SpecificationJava Language Specification

Defines the Java standard and the technical definition of the languagedefinition of the language.

includes the syntax and semantics of the language.

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

9

Page 10: Introduction to Java Programming Language

Application Program InterfaceApplication Program Interface

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.l h lApplies to current Java technology.

10

Page 11: Introduction to Java Programming Language

Java APIJava API

11

Page 12: Introduction to Java Programming Language

Java APIJava API

There are 3 editions of the Java API:

Java 2 standard edition (J2SE)Java 2 standard edition (J2SE) • Client‐side standalone applications or applets.Java 2 Enterprise Edition (J2EE) p ( )• Server‐side applications, such as Java servlets and 

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

12

Page 13: Introduction to Java Programming Language

Demonstrate how to link to Java APIAPI

13

Page 14: Introduction to Java Programming Language

J2SE versions and JDKJ2SE versions and JDK

There are many versions of J2SE.Sun releases each version of J2SE with a Java Development toolkit (JDK)Development toolkit (JDK).

JDK consists of a set of separate programs for developing and testing Java programsdeveloping and testing Java programs.

Each of which is invoked from a command line.

For J2SE 5 0 the Java development toolkit is calledFor J2SE 5.0, the Java development toolkit is called JDK 5 – formerly was known as JDK1.5.

The latest version is J2SE 6.

14

Page 15: Introduction to Java Programming Language

Java Development Tools

A software that provides an integrated development

Java Development Tools

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

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

Other useful tools:Code warrior by MetroworksTextPad EditorJCreator LEJeditBlueJ

15

Page 16: Introduction to Java Programming Language

Byte‐Code and the i l hi ( )Java Virtual Machine (JVM)

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 byteThe Java Virtual Machine (JVM) translates the byte code into machine language.

16

Page 17: Introduction to Java Programming Language

PortabilityPortability

Portable means that a program may be writtenPortable 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 y pmodification.Java byte code runs on the JVM and not on any

ti l CPU th f il d Jparticular CPU; therefore, compiled Java programs are highly portable.JVMs exist on many platforms:JVMs exist on many platforms:

WindowsMacintoshLinuxLinux

17

Page 18: Introduction to Java Programming Language

PortabilityPortability

Byte code(.class)

Java Virtual Java VirtualMachine for Windows Java VirtualMachine for Unix

Java VirtualM hi f Li

Java VirtualM hi f M i t h

18

Machine for Linux Machine for Macintosh