Java peresentation new soft

22
JAVA Programming Language Mohamed Refaat

description

Simple introduction to java programming

Transcript of Java peresentation new soft

Page 1: Java peresentation new soft

JAVA Programming LanguageMohamed Refaat

Page 2: Java peresentation new soft

Historical View Sun formally announced Java at an

industry conference in May 1995. Java is now used to develop large-scale

enterprise applications.

Page 3: Java peresentation new soft

Java Class Libraries Java programs consist of pieces called

classes. Classes include pieces called methods

and Object that perform tasks.

Page 4: Java peresentation new soft

JAVA Characteristic Object-oriented. Portable - platform independent.

Simpler development - strong and static typing.

Familiar - took the best out of C++.

Page 5: Java peresentation new soft

JVM – Java Virtual Machine JVM is an interpreter that translates Java

bytecode into real machine language instructions.

Compiled once run on any machine that has a JVM.

Page 6: Java peresentation new soft

JVM – Java Virtual Machine Java SDK (Software Development

Kit). JRE (Java Runtime Environment). JDK (Java Development Kit).

Page 7: Java peresentation new soft

JVM – Java Virtual Machine

Page 8: Java peresentation new soft

IDE – Integrated Development Environment Oracle JDeveloper.

Eclipse.

NetBeans.

And More…

Page 9: Java peresentation new soft

How To Work… Download Java JDK from this Link. Install JDK. Use one of the Previous editor (IED) for

develop.

Page 10: Java peresentation new soft

Hello World…package HelloWorld;public class HelloWorld {public HelloWorld() {}// Constructorpublic HelloWorld(String s){

System.out.println(s);}public static void main(String[] args) {

// TODO Auto-generated method stubSystem.out.println("I'm JAVA Programmer...");

}}

Page 11: Java peresentation new soft

Main Method Like C ,C++ and C#, Java applications

must define a main() method in order to be run.

Page 12: Java peresentation new soft

Primitive Types

Page 13: Java peresentation new soft

Flow Control

Page 14: Java peresentation new soft

For each For each input [i] in iterator a do

int [] a = new int[10];for(int i : a){

System.out.println(i);}

Page 15: Java peresentation new soft

Using Packagesimport HelloWorld.*;…

HelloWorld hw=new HelloWorld();

Page 16: Java peresentation new soft

Visibility of Members public

Can be accessed from outside the package. protected

Can be accessed from derived classes private

Can be accessed only from the current class default ( if no access modifier is stated )

Can be called within the same package.

Page 17: Java peresentation new soft

The Object Class Root of the class hierarchy. Any Class extends Object Class. boolean equals(Object o) // check equality String toString() // called when print the class out Put Class

name

EX: System.out.println(hw); Has many other uses class

EX: Math,

Page 18: Java peresentation new soft

Equality Test EX: String ExampleHelloWorld hw1 = new HelloWorld ();HelloWorld hw2 = new HelloWorld ();if (hw1 == hw2){System.out.println("hw1 == hw2");}

Page 19: Java peresentation new soft

Generic Define generic object.

Can use the same object with deferent type.

ArrayList<String> arrList = new ArrayList<String>();ArrayList<Integer> arrList = new ArrayList<Integer>();

Page 20: Java peresentation new soft

Collections Set :

A collection that does not contain duplicates. List :

An ordered collection that can contain duplicate elements. ArrayList.

Map : Associates keys to values and cannot contain duplicate keys.

Queue :

Page 21: Java peresentation new soft

Resources JAVA Tutorial

http://docs.oracle.com/javase/tutorial/

JAVA Documentation http://docs.oracle.com/javase/6/docs/api/

JAVA Book Java How to Program 7th Edition (2007)

You can find this presentation and SMS Project on this link https://docs.google.com/open?id=0BwXvifbsCL2iSmst

REd1UHZ3N3M

Page 22: Java peresentation new soft

Thanks …