Upload
jay-bilimoria
View
224
Download
0
Embed Size (px)
Citation preview
8/22/2019 Session1 - Introduction to Java-Final
1/28
Introduction to Java
Session 1
8/22/2019 Session1 - Introduction to Java-Final
2/28
Introduction to Java / 2 of 28
Objectives
Discuss Java in brief
Explore the types of Java programs Discuss what we can do with Java?
Examine the differences between Applets andApplications
Describe the Java Virtual Machine (JVM) Explore the features of some IDEs
Discuss the JDK and tools under it
Discuss future trends and technologies
Discuss the brief history of Java
8/22/2019 Session1 - Introduction to Java-Final
3/28
Introduction to Java / 3 of 28
Introduction to Java
Java being secure, portable and platformindependent was found to be capable ofaddressing large scale problems across the
Internet
Introduced in 1995 by Sun Microsystems
Objective was to develop a software forembedding in consumer electronic devices
Initially called Oak
Internet users had problems of portability and
platform independence
8/22/2019 Session1 - Introduction to Java-Final
4/28
Introduction to Java / 4 of 28
What is Java?
A cross platform language
It is used for stand-alone applications, net
based programs and to program consumerdevices
For e.g.: cellular phones, palm pilots
An object-oriented programming language
8/22/2019 Session1 - Introduction to Java-Final
5/28
Introduction to Java / 5 of 28
Java and the internet
Applets can respond to user input and actions
Programs on the Net are either static or
dynamic
Applets help develop dynamic programs
Applets run on Java enabled web browser
8/22/2019 Session1 - Introduction to Java-Final
6/28
Introduction to Java / 6 of 28
Security issues (1)
This can be a potential risk for the users
system
An Applet has to be downloaded on the users
system before it can work
Hence, applets are restricted from accessing all
areas of the disk
8/22/2019 Session1 - Introduction to Java-Final
7/28Introduction to Java / 7 of 28
Security issues (2)
JVM generates byte codes as a result ofcompilation
Byte codes cannot be executed without the JVM
This control is exercised by the
8/22/2019 Session1 - Introduction to Java-Final
8/28Introduction to Java / 8 of 28
Types of Java programs (1) Applets
Programs created specially to work with the
Internet
Displays an image GUI to accept user input
8/22/2019 Session1 - Introduction to Java-Final
9/28Introduction to Java / 9 of 28
Types of Java programs (2) Command line applications
Java programs that run from a command prompt
and do not display any GUI screen
8/22/2019 Session1 - Introduction to Java-Final
10/28Introduction to Java / 10 of 28
Types of Java programs (3) GUI Applications
Java programs that run stand-alone and accept
user input through a GUI based screen
8/22/2019 Session1 - Introduction to Java-Final
11/28Introduction to Java / 11 of 28
Types of Java programs (4)
Client sends request which is processed by theserver
The server side APIs extend capabilities of
standard APIs and are known as Servlets Also called server side applets
For e.g. HTML form processing, processdatabases and perform server side transactions
Servlets
Suitable for web based n-tier application
development
8/22/2019 Session1 - Introduction to Java-Final
12/28Introduction to Java / 12 of 28
Types of Java programs (5)
A programmer can create his/her own packages
or use the built-in packages
java.awt, java.io and java.applet are some examples
Database applications Uses JDBC API for database connectivity
Programs can be either applets or application
Packages
Class libraries in Java
8/22/2019 Session1 - Introduction to Java-Final
13/28Introduction to Java / 13 of 28
What can we do with Java?
Colorful scrolling banner for web pages
Interactive quiz A program that plays audio, displays a banner and
animates images at the same time
Interactive games that can run as stand alone or
deployed on the web
One can develop:
Create a wide variety of applications from a
simple computation program to complex
distributed application
8/22/2019 Session1 - Introduction to Java-Final
14/28Introduction to Java / 14 of 28
Difference between
Applets and Applications (1)
Do not need a browser
to execute
These run within JVM
Executed in a java
compatible web
browser
Applets load and run on
a Java-enabled web
browser
Applications Applets
8/22/2019 Session1 - Introduction to Java-Final
15/28
Introduction to Java / 15 of 28
Difference between
Applets and Applications (2)
Manages its own flow of
execution
No restrictions about
reading or writing
from/to the local filesystem
Flow of execution is
partly managed by thebrowser context
Cannot read/write
from/to the local file
system
Applications Applets
8/22/2019 Session1 - Introduction to Java-Final
16/28
Introduction to Java / 16 of 28
Similarities in
Applets and Applications (1)
Both can use the Abstract Windowing Toolkit
(AWT)
Both need to use the standard Java class
libraries
8/22/2019 Session1 - Introduction to Java-Final
17/28
Introduction to Java / 17 of 28
Java Virtual Machine (JVM)
Java code can run on any platform by using JVM
JVM normally reads and executes Java
statements one at a time
JVM is responsible for platform independence and
small size compiled code
Recognizes only a particular binary format called
a class file
Has an interpreter component that enablescommunication between Java byte code and a
computers operating system
8/22/2019 Session1 - Introduction to Java-Final
18/28
Introduction to Java / 18 of 28
Visual development tools
Simplifies the software development process
Includes class browser for viewing and
navigating through the class hierarchy Includes a source code editor that helps code
programs
Helps in quick and efficient development of
Java applications and applets
8/22/2019 Session1 - Introduction to Java-Final
19/28
Introduction to Java / 19 of 28
Some visual development tools
Borland Jbuilderfrom Borland/Inprise Includes an integrated editor, debugger, compiler, visual
designer, wizards and sample applications
Forte for Java, Community Edition from SunMicrosystems Integrated visual design, editing, compilation and debugging
capabilities to create applets and applications
Visual Age for Java from IBM Works with existing databases, applications and transactions
8/22/2019 Session1 - Introduction to Java-Final
20/28
Introduction to Java / 20 of 28
Java Development Kit (JDK)
Basically a set of command line tools
Three major releases are :
Java 1.0 first release
Java 1.1 1997 release
Java 2 latest release
Freely available at Suns official website
Contains the software and tools needed tocompile, debug and execute applets andapplications
8/22/2019 Session1 - Introduction to Java-Final
21/28
Introduction to Java / 21 of 28
Tools under JDK (1)
Syntax : javac [option] source
Source files end with extension .java
Options can include
-classpath
-d
-g
-o
-verbose
javac : compiler used to compile Java source
code
8/22/2019 Session1 - Introduction to Java-Final
22/28
Introduction to Java / 22 of 28
Tools under JDK (2)
java [option] classname [arguments]
Options can include
-classpath
-Dname name -help
-v orverbose
-X
java: interpreter used to execute Java byte
codes
8/22/2019 Session1 - Introduction to Java-Final
23/28
Introduction to Java / 23 of 28
Tools under JDK (3)
javadoc : This is the Java documentation tool
Generates detailed documentation in HTML formfor any .java source code or package
appletviewer: Used to view and test applets
Syntax : appletviewer [options] url
8/22/2019 Session1 - Introduction to Java-Final
24/28
Introduction to Java / 24 of 28
New features in Java2 (1)
Drag and Drop interactively transferring
information across different applications and
from one part of a programs interface to
another
Swing new set of classes and interfaces
used to create an advanced GUI
8/22/2019 Session1 - Introduction to Java-Final
25/28
Introduction to Java / 25 of 28
New features in Java2 (2)
Java Sound totally new set of features
pertaining to Javas audio features
RMI Remote Method Invocation allows
applications to call objects located at remote
sites and communicate with them
Java 2D API set of classes for advanced
2D graphics and imaging
8/22/2019 Session1 - Introduction to Java-Final
26/28
Introduction to Java / 26 of 28
Present Java technologies (1)
Support for distributed computing in the formof features such as RMI
Database management support in the form ofJDBC
Reusable software components in the form ofJavaBeans
Creation and deployment of applications that
can run on any operating system
8/22/2019 Session1 - Introduction to Java-Final
27/28
Introduction to Java / 27 of 28
Present Java technologies (2)
Java 2 Enterprise Edition (J2EE) which
includes :
8/22/2019 Session1 - Introduction to Java-Final
28/28
Future trends
Miniature devices such as Palm pilots andmobile phones are equipped with a features
such as email, gaming options and manyothers
They are based upon Java 2 Micro Edition(J2ME)
New products in the area of embedded
technologies for consumer devices by making
use of mobile computing