lecturer pen phirom tel : 012 602908 e-mail : [email protected] web site: lecturer pen phirom tel...

13
Lecturer PEN PHIROM Tel : 012 602908 E-mail : [email protected] Web site: http://penphirom.com Chapter 1 INTRODUCTION TO JAVA

Upload: jeffrey-goodman

Post on 26-Dec-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Lecturer PEN PHIROMTel : 012 602908E-mail : [email protected] site: http://penphirom.com

Chapter 1

INTRODUCTION TO JAVA

Page 2: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Focus on and Learning outcome

• This lesson focus on:– Birth of JAVA Program– Feature of JAVA Program– Type of IDE for develop JAVA Program– Syntax to write JAVA Code

• Learning outcome:– Know how to write java code in NetBean IDE.

Page 3: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Content

• History of Java• Java Version• Feature of Java• Java 2 software Development kit(J2SDK)• Java Virtual Machine• How to write java source code

Page 4: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

History of Java

• Java was developed in 1991 by James Gosling at Sun Microsystems to be used as a solution for household appliances such as remote control, microwave oven,… But it is not interesting to market.

• Java is C/C++ based language.• When the World Wide Web become popular in 1995,

Java come to life again.• Java is now consider as native language of the

internet.• Java is a full Object Oriented Programming

Page 5: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Version of JAVA

1996

use private and protected together to create another form of protection

Version 1.0(First JDK)

1997

An extensive retooling of the AWT event model,inner classes , JavaBeans, JDBC,RMI, reflection

Version 1.1(JDK)

1998

-strictfp keyword-Swing as Core Class-JVM was equipped with a JIT compiler,Java Plug-in, Java IDL(CORBA ), Collections framework

Version 1.2(J2SE|ME)

Page 6: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Version of JAVA

2000

HotSpot JVM includedRMI support optional compatibility with CORBAJavaSound,JNDI, JPDA,Synthetic proxy classes

Version 1.3(J2SE)

2002

exception chaining, IPv6) support, regular expressions, integrated XML parser and XSLT processor (JAXP), integrated security and cryptography extensions, Java Web Start

Version 1.4(J2SE)

2004

Autoboxing/unboxing, Enumerations, Varargs, Enhanced for each loop, Metadata

Version 5(J2SE)

Page 7: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Version of JAVA

2006

Improved Web Service support through JAX-WS, JDBC 4.0 support, Upgrade of JAXB to version 2.0, Many GUI improvements

Version 6(SE)

2011

The ability to cast from an Object type to a primitive type directly, Enhanced library-level support for new network protocols, Upstream updates to XML and Unicode

Version 7(SE)

2013

Expected

Version 8(SE)

Page 8: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Feature of Java

• Simple: not support pointer, operator overloading• Object-Oriented: use object when run time• Statically type: must declare before use and object• Compiled: must compile before run source code• Architecture neutral and portable: platform independent• Multithreads: multitasking supported.• Garbage collected: auto release object from memory• Robust: preventing system crash when error• Secure: strict access area of system • Extensible: can access native method of C++

Page 9: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Java 2 software Development kit

• Java API for develop java program has:– JDK7

• IDE helps to develop a java program:– Borland JBuilder– NetBean– JCreater– Visual Café– TextPad

Page 10: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Java Virtual Machine

Page 11: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

How to write java source code

syntax:Package Name;

Import PackageName;

public class ClassName

{

public static void main(String[ ] arg)

{

Block statement

}

}

Page 12: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Example

File Name:Test.javapublic class Test{ public static void main(String[ ] arg) { System.out.println(“Hello Java”); }}

Page 13: Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com Web site:  Lecturer PEN PHIROM Tel : 012 602908 E-mail : penphirom@yahoo.com

Install and use IDE

• Install NetBean– Download JDK and NetBean from web site

http://www.oracle.com/technetwork/java/javase/downloads/index.html

– Install JDK– Adding JDK Path to environment variable(Optional)– Install NetBean

• NetBean Management Tools:– Create project– Create Package– Create Class– Compile and Run Java source code