Вы находитесь на странице: 1из 32

Intro to Java

Can you make coffee with it?

Java - An Introduction

Java - The new programming language developed by Sun Microsystems in 1991. Originally called Oak by James Gosling, one of the inventors of the Java Language. Java -The name that survived a patent search Java Authors: James , Arthur Van , and others

It was meant to!!


A programming language for appliances!

Must Run on Any Architecture


WRITE ONCE, RUN ANYWHERE!
Program in Java

debug

pretty portable

Java Compiler

Java Bytecode

Java Virtual Machine

Java Virtual Machine

Java Introduction

Originally created for consumer electronics (TV, VCR, Freeze, Washing Machine, Mobile Phone). Java - CPU Independent language Internet and Web was just emerging, so Sun turned it into a language of Internet Programming. It allows you to publish a web page with Java code in it.

Doesnt Make Coffee Yet

So Whats Java Good For?


Web applications!

Java Applet Java Applet

Server

Java Milestones
Year 1990 Development Sun decided to developed special software that could be used for electronic devices. A project called Green Project created and head by James Gosling. Explored possibility of using C++, with some updates announced a new language named Oak The team demonstrated the application of their new language to control a list of home appliances using a hand held device.

1991

1992

1993

The World Wide Web appeared on the Internet and transformed the text-based interface to a graphical rich environment. The team developed Web applets (time programs) that could run on all types of computers connected to the Internet.

Java Milestones
Year 1994 Development The team developed a new Web browsed called Hot Java to locate and run Applets. HotJava gained instance success.

1995

Oak was renamed to Java, as it did not survive legal registration. Many companies such as Netscape and Microsoft announced their support for Java

1996

Java established itself it self as both 1. the language for Internet programming 2. a general purpose OO language.

1997-

A class libraries, Community effort and standardization, Enterprise Java, Clustering, etc..

10

Java 1.0
8 packages 212 classes

Java 1.1
23 packages 504 classes

Java 1.2
59 packages 1520 classes

Java 1.3
77 packages 1595 classes

Java 1.4

Java 1.5

103 packages 131 packages 2175 classes 2656 classes Regular Exp Logging Assertions NIO javax.activity, javax. management

New Events Inner class

JFC/Swing Drag and Drop

JNDI Java Sound Timer

Object Serialization Java2D Jar Files International Reflection JDBC RMI

CORBA

java.nio, javax.imageio, javax.net, javax.print, javax.security, org.w3c javax.naming, javax.sound, javax.transaction

javax.accessibility, javax.swing, org.omg

java.math, java.rmi, java.security, java.sql, java.text, java.beans java.applet, java.awt, java.io, java.lang, java.net, java.util

11

Java Buzz Words


Simple Secure Portable Object - oriented Robust Multithreaded Architecture-neutral Distributed Interpreted Dynamic High performance
12

The Java programming environment

Object-orientation: Classes + Inheritance Distributed: RMI, Servlet, Distributed object programming. Robust: Strong typing + no pointer + garbage collection Secure: Type-safety + access control Architecture neutral: architecture neutral representation

13

The Java programming environment

Java byte code: Intermediate representation for Java programs Java compiler: Transform Java programs into Java byte code Java interpreter: Read programs written in Java byte code and execute them Java virtual machine: Runtime system that provides various services to running programs Java programming environment: Set of libraries that provide services such as GUI, data structures,etc. Java enabled browsers: Browsers that include a JVM + ability to load programs from remote hosts
14

Overlap of C, C++, and Java

C++

Java

15

Java better than C++ ?

No Typedefs, Defines, or Preprocessor No Global Variables No Pointers No Unsafe Structures No Multiple Inheritance No Operator Overloading No Automatic Coercions

16

Java Development Kit



javac - The Java Compiler java - The Java Interpreter jdb- The Java Debugger appletviewer -Tool to run the applets
javap - to print the Java bytecodes javaprof - Java profiler javadoc - documentation generator javah - creates C header files

17

Process of Building and Running Java Programs


Text Editor Java Source Code

javadoc

HTML Files

javac

Java Class File

javah

Header Files

java

jdb

Outout
18

How are Java programs written?

Define a class HelloWorld and store it into a file: HelloWorld.java:


public class HelloWorld { public static void main (String[] args) { System.out.println(Hello, World); } }

Compile HelloWorld.java
javac HelloWorld.java

Output: HelloWorld.class

Run
java HelloWorld

Output: Hello, World


19

Compiling and Executing a Java Program

20

Execution Platform
What is an execution platform? 1) An execution platform is the hardware or software environment in which a program runs, e.g. Windows 2000, Linux, Solaris or MacOS. 2) Most platforms can be described as a combination of the operating system and hardware.

21

Java Execution Platform


What is Java Platform? 1) A software-only platform that runs on top of other hardware-based platforms. 2) Java Platform has two components: a) Java Virtual Machine (JVM) interpretation for the Java bytecode, ported onto various hardware-based platforms. b) The Java Application Programming Interface (Java API)

22

Java Execution Platform

23

Java Platform Independence

24

Java Program Execution


Java programs are both compiled and interpreted: Steps: write the Java program compile the program into bytecode execute (interpret) the bytecode on the computer through the Java Virtual Machine Compilation happens once. Interpretation occurs each time the program is executed.

25

Java Execution Process

26

Java API
What is Java API? 1) a large collection of ready-made software components that provide many useful capabilities, e.g. graphical user interface 2) grouped into libraries (packages) of related classes and interfaces 3) together with JVM insulates Java programs from the hardware and operating system variations

27

Java Program Types


Types of Java programs: 1) applications standalone (desktop) Java programs, executed from the command line, only need the Java Virtual Machine to run 2) applets Java program that runs within a Javaenabled browser, invoked through a applet reference on a web page, dynamically downloaded to the client computer 3) servlets Java program running on the web server, capable of responding to HTTP requests made through the network 4) etc.
28

Java Platform Features 1


1) essentials - objects, strings, threads, numbers, input/output, data structures, system properties, date and time, and others. 2) networking:
1) Universal Resource Locator (URL) 2) Transmission Control Protocol (TCP) 3) User Datagram Protocol (UDP) sockets 4) Internet Protocol (IP) addresses

3) internationalization - programs that can be localized for users worldwide, automatically adapting to specific locales and appropriate languages.

29

Java Platform Features 2


4) security low-level and high-level security, including electronic signatures, public and private key management, access control, and certificates 5) software components JavaBeans can plug into an existing component architecture 6) object serialization - lightweight persistence and communication, in particular using Remote Method Invocation (RMI) 7) Java Database Connectivity (JDBC) - provides uniform access to a wide range of relational databases

30

Java Technologies
Different technologies depending on the target applications: 1) desktop applications - Java 2 Standard Edition (J2SE) 2) enterprise applications Java 2 Enterprise Edition (J2EE) 3) mobile applications Java 2 Mobile Edition (J2ME) 4) smart card applications JavaCard 5) etc. Each edition puts together a large collections of packages offeringfunctionality needed and relevant to a given application. The Java Virtual Machine remains essentially the same.

31

Java Technology: SDK

32

Вам также может понравиться