introduction to java

Download Introduction To Java

If you can't read please download the document

Upload: tushar-chauhan

Post on 16-Apr-2017

4.374 views

Category:

Documents


0 download

TRANSCRIPT

Introduction to Java

Tushar ChauhanOsum LeaderC.U.Shah College Of Engineering & Technology, Wadhwan City

Agenda

What is Java?

A little bit of history

Java performance

Java sintax

Java packages

Java applications

Demo

Where and how to learn Java

What is Java???

An exotic island...?

Friendly people, spicy food, beautiful beaches

An IT Brand?

What is Java?

An object oriented programming language developed in the early '90s.

The language itself takes much of its syntax from C and C + + but has a simpler object model and eliminates low-level tools.

It is platform independent. Early implementations of Java had the slogan: "write once, run anywhere"

It has a system of automatic memory management.

A programming language

A platform

And where is Java?

Java is everywhere...

Where is Java?

It's here...

Where is Java?

And here...

Where is Java?

And here...

A little bit of history

A little bit of history

It was conducted by a team of 13 people, led by James Gosling.

Gosling's goals were to implement a virtual machine and a language with a structure and syntax similar to C + +.

Java was originally created as a programming tool for a project set-top box known as * 7.

A little bit of history (II)

The language was originally called "Oak". Later renamed "Green" after discovering that Oak was already a trademark.

The term "Java" was coined in a coffee store frequented by members of the team.

It is unclear if it is an acronym or not, some hypotheses suggest that it could be the initials of its creators: James Gosling, Arthur Van Hoff, and Andy Bechtolsheim. Other advocates of "Just Another Vague Acronym.

The most accepted hypothesis is that Java is named after a type of coffee available in the coffee store.

Java Architecture

.java, .class, JVM???

In Java, source code is written in a plain text file with a .Java extension

Then, the code is compiled into a .Class file. A .Class does not contain native code for a type of processor, instead it contains bytecodes.

Finally, the application is interpreted by the Java virtual machine, transforming the bytecode to native code at runtime.

Bytecode

The bytecode is the native language of any implementation of Java Virtual Machine. In this way, a Java program runs on any platform with a JVM.

Java platform

Java CardJava SEJava EEJava MEJava FXAhora vamos a hablar acerca de las diferentes plataformas Java existentes que permiten desarrollar aplicaciones en una aplica gama de dispositivos y contextos.

Java Card es el plataforma que permite desarrollar software para dispositivos pequeos que utilizan tarjetas inteligentes y software empotrado como lectoras de cdigo de barras o lectoras de tarjetas de crditos. Esta plataforma es ms utilizada por los fabricantes de estos dispositivos.

Con la versin 1.2, Java se separ en tres plataformas: J2SE (ahora Java SE), J2EE (ahora Java EE) y J2ME (ahora Java ME). La primera de ellas conserva el ncleo original del lenguaje y sus APIs y est pensada para el desarrollo de aplicaciones de escritorio y applets. Cubre muchas funcionalidades como soporte de GUI con Swing y AWT, I/O, multithreading, etc.

Java EE es la plataforma para desarrollo de aplicaciones Web empresariales y grandes sistemas distribuidos. Ser encarga de la interaccin entre servidores de aplicaciones y de bases de datos, persistencia de datos, seguridad, etc.

Java ME es la plataforma que permite que nosotros podamos escribir aplicaciones para nuestros propios celulares, PDAs y PocketPCs. Java ME utiliza solo una parte de las APIs de Java SE y suministra sus propias bibliotecas de soporte.

Por ltimo tenemos a Java FX, la plataforma ms reciente de Java y que pretende competir con Adobe y Flash y con Microsoft y Silverlight en el desarrollo de aplicaciones RIA (Rich Internet Applications). Estas aplicaciones se caracterizan por ejecutarse en los navegadores y tener una interfaz grfica muy rica en cuanto a grficos e interaccin con el usuario. Java FX introduce su propio lenguaje script.

Java platform

D:\My Presentation\Unijoyo Java Presentation\img\java platform.gifEn este grfico podemos apreciar como se distribuye el soporte de los diferentes dispositivos existentes entre las 3 plataformas principales de Java. Podemos apreciar que existen mltiples tipos de mquinas virtuales, como la CVM, KVM y la JVM.

Java Language

Object oriented

Distributed

Simple

Multithread

Safe

Platform independent

Some concepts...

Distributed: Java is distributed because it offers support for distributed network technologies such as RMI (remote method invocation), CORBA (common object request broker architecture) and URI (universal resource locator)

Simple: No pointers, no garbage collector

Multithreading

Safe: restrictions on access to devices directly (pointers)

Java syntax

Java syntax in detail

Variable initialization

The Java language is strongly typed, which means that all variables must be declared before use.

int unaVariable = 1;

String Class

Java provides special support for the strings via the java.lang.String class

It is not a primitive type.

However, by overloading operators you can perform operations such as:

String unString = Juan + + Perez;Java also provides a wide range of operations to manipulate instances of this class.

Example with arithmetic operators

int i=2+3; // i equals 5

i=i+1; //i equals 6

i=6*2; //i equals 12

i=2+5*2%8; //i equals 4

Example with posfix and unary operators

int i=5; // i equals 5

System.out.println(i); //print:5

System.out.println(++i); //print:6

System.out.println(i++); //print:6

System.out.println(i); //print:7

Control sentences: if

if(expr){....}

if(expr) sentencia;

if(expr){....} else {....}

Control sentences: switch

Switch (num){ case num1:...break; case num2:...break; default:...break;}

Control sentences: while and do-while

while (expr){....}

do {....}while(expr);

Control sentences: for

for (exprInic; stopCond; nextStep){....}

for (int i=0; i