SlideShare a Scribd company logo
Java Basic PART I
Soumen Santra
MCA, M.Tech, SCJP, MCP
Java
Write Once, Run Anywhere
IN ANY
PLATFORMONE
SOURCE
CODE
Java : Components
Editor: Write the source code.
Linker: Link the Source code with the library files.
Java Compiler – Keyword javac use as convert Java source code to bytecode.
Bytecode - An intermediate form, known as native code, closer to machine code.
JVM-Java Virtual Machine , a concept of target platform which interprets the bytecode.
Interpreter-The interpreter demonstrates the platform independent .class file to equivalent
machine dependent code to run. Keyword java.
Javadoc-API Documentation generator.
JRE- Java Runtime Environment.
Java : Features
JVM uses bytecodes as .class file.
Light-weight Small binary class files for fast execution.
Just-in-time (JIT) Compilers for compiling only changes code.
Multithreading for high process and memory management.
Native Methods Interfaces as JNDI.
Native Methods Libraries.
Java : Features (Cont..)
Class Loader.
Dynamic.
Good communication constructs.
Secure.
Portable and Compatible.
Understandable and easy-to-write.
Fully Object Oriented.
Support Console based, Windows based and Web based application.
Case-sensitive.
JRE.
Jdk (Java Development toolkit).
General Language Features
C/C++ like syntax, ends with ;
No pointers concept.
Objects taken all controls.
Objects communicates with objects through messages.
Messages result in invocation of class methods.
Java : Security
Language designed as safe.
Strict compiler javac & JIT.
Dynamic Runtime Loading (Verifier).
Runtime Security Manager.
Jar- Create & manage all the java archive files.
Method area.
Heap.
JVM language stacks.
Pc registers.
Native method stacks.
Java kernel.
Security Manager
Prevents unauthorized disk read/writes.
Restricts network access without creating dynamic link library files.
Restricts Other access (native methods).
Implementation is browser or processor dependent.
Object Oriented Languages Comparison with java
C++
Objective C
Ada Java
Encapsulation Yes Yes Yes Yes
Inheritance Yes Yes No Yes
Multiple Inheritance Yes Yes No No
Polymorphism Yes Yes Yes Yes
Binding (Early/Late) Both Both Early Both
Concurrency Poor Poor Difficult Yes
Garbage Collection No Yes No Yes
Genericity Yes No Yes No
Class Libraries Yes Yes Limited Yes
FEATURES
Features Removed From C++
Operator overloading.
Pointers of Array/pointers.
Multiple-inheritance of implementation through class inherit concept.
Enum, typedef, #define.
Copy constructors, destructors.
Templates.
And many more....
Added or Improved over C++
Interfaces over class.
Garbage collection.
Exceptions (More featureful than C++).
Strings and many implementation.
Instanceof.
Package.
Multi-threads.
Java better than C++
No Typedefs, Defines, or Preprocessor.
No Global Variables.
No goto statement.
No Pointers.
No Unsafe Structures.
No Multiple Inheritance.
No Operator Overloading.
No Automatic Coercions.
No Fragile Data Types.
No copy constructor.
Basic Data Types
Data Types
boolean either true of false
char 16 bit Unicode 1.1
byte 8-bit integer (signed)
short 16-bit integer (signed)
int 32-bit integer (signed)
long 64-bit integer (signed)
float 32-bit floating point
double 64-bit floating point
String (class for manipulating strings)
String,
StringBuilder,
StringBuffer,
StringTokenizer
 Java uses Unicode to represent characters internally.
Java Integrates
Power of Compiled Languages
and
Flexibility of Interpreted Languages
 Applet.
 Swing & Layout Manager.
 Hibernate.
 Struts.
 Spring
 Servlet
 Java Server Pages (JSP)
 Java Bean.
 Enterprise Java Bean (EJB).
 J2ME.
 Junit.
 & Many More.
Power of Java and the Web
Deliver .exe, not just .class.
Remove porting.
Remove end-user installation.
Remove software distribution costs.
Access by millions of customers through web.
Applications : Types
Different possibilities to write/run a Java codes are:
Application- A stand-alone program that can be invoked from command line through
console which has a “main” method.
Applet- A program embedded in a web page , to be run when the page is browsed . A
program that contains no “main” method.
Application -Java interpreter
Applets- Java enabled web browser (Linked to HTML via <APPLET> tag.
in html file or run through Appletviewer).
Java
Bytecodes
move locally
or through
network
Java
Source
code
(.java)
Java
Compiler
Java
Bytecode
(.class )
Java
Interpreter
Just in
Time
Compiler
Runtime System
Class
Loader
Bytecode
Verifier
Java
Class
Libraries
Operating System
Hardware
Java
Virtual
machine
Runtime
Environment
Compile-time
Environment
Life Cycle of Java Code
Lifecycle of Java Code
Java Development Kit
javac – Name of the Java Compiler.
java - Name of the Java Interpreter.
jdb- Name of the Java Debugger.
appletviewer - Name of the Tool to run the applets code and give Applet window.
javap – Use to print the Java bytecodes.
javaprof - Name of the Java profiler.
javadoc - Name of the documentation generator.
javah - Name of the creates C header files.
Javak= Name of the Kernel of the java.
Bytecode Verifier
It Called when the class is first loaded in runtime environment by JRE.
It Verifies the bytecodes meet certain set of properties.
Verified code runs faster through JRE.
After verification, interpreter defines memory layout.
Release all memories through Garbage collector.
Java Example : Hello World
// HelloWorld.java: Hello World program
class HelloWorld
{
public static void main(String args[])
{
System.out.println(“Hello World of Java”);
}
}
Program Processing for Output
Compilation
# javac HelloWorld.java
outputs in HelloWorld.class
Execution
# java HelloWorld
Hello World of Java
#
Simple Java Applet Example
// HelloApplet.java: A sample applet
import java.applet.*;
public class HelloApplet extends Applet {
public void paint(Graphics g)
{
g.drawString(“Hello Applet !”,250,250);
}
}
Prints Hello Applet !
In Applet window
At (250,250) (x,y)
coordinate
Execution of an Applet by HTML
<HTML>
<TITLE> Hello Applet </TITLE>
<APPLET code=“HelloApplet.class” width=500 height=500
align=“right ”>
</APPLET>
</HTML>
Mechanism of Applets
Hello Applet
HelloApplet Java
<app=
“HelloApplet ”>
4
APPLET
Development
“HelloApplet.java”
At
terminal
The Web
HelloApplet .class
AT
WEB SERVER
2 31 5
Create
Applet
tag in
HTML
document
Accessing
from
Client
The browser
creates
a new
window and
a new thread
and
then runs the
code
Sequence Diagram : Classic Web Perspective
Sequence Diagram : Java Web Interaction
Significance of downloading Applets
Interaction with World wide web w3 consortium.
Dynamic animated web page instead of static web pages.
Applets react to users interactive application.
Could not connect network activity.
Do not create dynamic link library files in cookies.
Used Java Main Packages
java.lang (by default added)
java.util
java.io
java.awt
java.awt.image
java.applet
java.net
java.sql
Thank You
Give Feedback

More Related Content

ODP
Java compilation
Mike Kucera
 
PDF
An Introduction to Java Compiler and Runtime
Omar Bashir
 
PDF
What is-java
Shahid Rasheed
 
PPTX
Java byte code & virtual machine
Laxman Puri
 
PPTX
JAVA BYTE CODE
Javed Ahmed Samo
 
PPTX
Java byte code presentation
Mahnoor Hashmi
 
PPTX
Java bytecode and classes
yoavwix
 
Java compilation
Mike Kucera
 
An Introduction to Java Compiler and Runtime
Omar Bashir
 
What is-java
Shahid Rasheed
 
Java byte code & virtual machine
Laxman Puri
 
JAVA BYTE CODE
Javed Ahmed Samo
 
Java byte code presentation
Mahnoor Hashmi
 
Java bytecode and classes
yoavwix
 

What's hot (20)

PDF
JAVA Program Examples
Prof Chethan Raj C
 
PPSX
Introduction to java
Ajay Sharma
 
PDF
Java basics notes
poonguzhali1826
 
PPT
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
PDF
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
PPT
CS Lesson: Introduction to the Java virtual Machine
Katrin Becker
 
PPT
Core Java
christ university
 
PPT
Java essential notes
Habitamu Asimare
 
PPTX
Java lab zero lecture
vishal choudhary
 
PPTX
Java lab lecture 1
vishal choudhary
 
PDF
Java notes
Manish Swarnkar
 
PPTX
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
PPTX
Java introduction
The icfai university jaipur
 
DOCX
Lecture19.07.2014
vishal choudhary
 
PPTX
Basics of JAVA programming
Elizabeth Thomas
 
PPTX
1.introduction to java
Madhura Bhalerao
 
PPT
1 Introduction To Java Technology
dM Technologies
 
PDF
Java unit 1
Shipra Swati
 
PPT
Byte code jvm
myrajendra
 
PPT
Basics of java programming language
masud33bd
 
JAVA Program Examples
Prof Chethan Raj C
 
Introduction to java
Ajay Sharma
 
Java basics notes
poonguzhali1826
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
CS Lesson: Introduction to the Java virtual Machine
Katrin Becker
 
Java essential notes
Habitamu Asimare
 
Java lab zero lecture
vishal choudhary
 
Java lab lecture 1
vishal choudhary
 
Java notes
Manish Swarnkar
 
Java history, versions, types of errors and exception, quiz
SAurabh PRajapati
 
Java introduction
The icfai university jaipur
 
Lecture19.07.2014
vishal choudhary
 
Basics of JAVA programming
Elizabeth Thomas
 
1.introduction to java
Madhura Bhalerao
 
1 Introduction To Java Technology
dM Technologies
 
Java unit 1
Shipra Swati
 
Byte code jvm
myrajendra
 
Basics of java programming language
masud33bd
 
Ad

Similar to Java Basic PART I (20)

PDF
OOPS JAVA.pdf
DeepanshuMidha5140
 
PPT
basic_java.ppt
sujatha629799
 
PPT
Java basic
Arati Gadgil
 
PDF
JAVA for Every one
Satyam Pandey
 
PDF
Javanotes ww8
kumar467
 
PPTX
2 22CA026_Advance Java Programming_Data types and Operators.pptx
dolphiverma80
 
PPTX
It pro dev_birbilis_20101127_en
George Birbilis
 
PPT
Object Oriented Programming-JAVA
Home
 
PPT
javaeanjjisjejrehurfhjhjfeauojksfjdi.ppt
eraqhuzay69
 
PPTX
Java programing language unit 1 introduction
chnrketan
 
PPTX
Curso de Programación Java Básico
Universidad de Occidente
 
PDF
Java Programming Fundamentals: Complete Guide for Beginners
Taranath Jaishy
 
PPT
01intro
Waheed Warraich
 
PPT
Java Intro
Vijay A Raj
 
DOCX
OOP-Chap2.docx
NaorinHalim
 
PPT
A begineers guide of JAVA - Getting Started
Rakesh Madugula
 
PDF
Java chapter 1
Mukesh Tekwani
 
PPTX
brief introduction to core java programming.pptx
ansariparveen06
 
PPTX
Unit1 JAVA.pptx
RahulAnand111531
 
OOPS JAVA.pdf
DeepanshuMidha5140
 
basic_java.ppt
sujatha629799
 
Java basic
Arati Gadgil
 
JAVA for Every one
Satyam Pandey
 
Javanotes ww8
kumar467
 
2 22CA026_Advance Java Programming_Data types and Operators.pptx
dolphiverma80
 
It pro dev_birbilis_20101127_en
George Birbilis
 
Object Oriented Programming-JAVA
Home
 
javaeanjjisjejrehurfhjhjfeauojksfjdi.ppt
eraqhuzay69
 
Java programing language unit 1 introduction
chnrketan
 
Curso de Programación Java Básico
Universidad de Occidente
 
Java Programming Fundamentals: Complete Guide for Beginners
Taranath Jaishy
 
Java Intro
Vijay A Raj
 
OOP-Chap2.docx
NaorinHalim
 
A begineers guide of JAVA - Getting Started
Rakesh Madugula
 
Java chapter 1
Mukesh Tekwani
 
brief introduction to core java programming.pptx
ansariparveen06
 
Unit1 JAVA.pptx
RahulAnand111531
 
Ad

More from Soumen Santra (20)

PDF
Basic and advance idea of Sed and Awk script with examples
Soumen Santra
 
PPT
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
PPTX
Cell hole identification in carcinogenic segment using Geodesic Methodology: ...
Soumen Santra
 
PPTX
PPT_PAPERID 31_SOUMEN_SANTRA - ICCET23.pptx
Soumen Santra
 
PPT
Basic networking hardware: Switch : Router : Hub : Bridge : Gateway : Bus : C...
Soumen Santra
 
DOC
Traveling salesman problem: Game Scheduling Problem Solution: Ant Colony Opti...
Soumen Santra
 
PPT
Optimization techniques: Ant Colony Optimization: Bee Colony Optimization: Tr...
Soumen Santra
 
PPT
Quick Sort
Soumen Santra
 
PPT
Merge sort
Soumen Santra
 
PPTX
A Novel Real Time Home Automation System with Google Assistance Technology
Soumen Santra
 
PPTX
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Soumen Santra
 
PPT
Threads Advance in System Administration with Linux
Soumen Santra
 
PPTX
Frequency Division Multiplexing Access (FDMA)
Soumen Santra
 
PPTX
Carrier Sense Multiple Access With Collision Detection (CSMA/CD) Details : Me...
Soumen Santra
 
PPTX
Code-Division Multiple Access (CDMA)
Soumen Santra
 
PPTX
PURE ALOHA : MEDIUM ACCESS CONTROL PROTOCOL (MAC): Definition : Types : Details
Soumen Santra
 
PPTX
Carrier-sense multiple access with collision avoidance CSMA/CA
Soumen Santra
 
PPTX
RFID (RADIO FREQUENCY IDENTIFICATION)
Soumen Santra
 
PPTX
SPACE DIVISION MULTIPLE ACCESS (SDMA) SATELLITE COMMUNICATION
Soumen Santra
 
PPT
Threads Basic : Features, Types & Implementation
Soumen Santra
 
Basic and advance idea of Sed and Awk script with examples
Soumen Santra
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Cell hole identification in carcinogenic segment using Geodesic Methodology: ...
Soumen Santra
 
PPT_PAPERID 31_SOUMEN_SANTRA - ICCET23.pptx
Soumen Santra
 
Basic networking hardware: Switch : Router : Hub : Bridge : Gateway : Bus : C...
Soumen Santra
 
Traveling salesman problem: Game Scheduling Problem Solution: Ant Colony Opti...
Soumen Santra
 
Optimization techniques: Ant Colony Optimization: Bee Colony Optimization: Tr...
Soumen Santra
 
Quick Sort
Soumen Santra
 
Merge sort
Soumen Santra
 
A Novel Real Time Home Automation System with Google Assistance Technology
Soumen Santra
 
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions
Soumen Santra
 
Threads Advance in System Administration with Linux
Soumen Santra
 
Frequency Division Multiplexing Access (FDMA)
Soumen Santra
 
Carrier Sense Multiple Access With Collision Detection (CSMA/CD) Details : Me...
Soumen Santra
 
Code-Division Multiple Access (CDMA)
Soumen Santra
 
PURE ALOHA : MEDIUM ACCESS CONTROL PROTOCOL (MAC): Definition : Types : Details
Soumen Santra
 
Carrier-sense multiple access with collision avoidance CSMA/CA
Soumen Santra
 
RFID (RADIO FREQUENCY IDENTIFICATION)
Soumen Santra
 
SPACE DIVISION MULTIPLE ACCESS (SDMA) SATELLITE COMMUNICATION
Soumen Santra
 
Threads Basic : Features, Types & Implementation
Soumen Santra
 

Recently uploaded (20)

PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
This slide provides an overview Technology
mineshkharadi333
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
CIFDAQ'S Market Insight: BTC to ETH money in motion
CIFDAQ
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Doc9.....................................
SofiaCollazos
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Chapter 2 Digital Image Fundamentals.pdf
Getnet Tigabie Askale -(GM)
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 

Java Basic PART I

  • 1. Java Basic PART I Soumen Santra MCA, M.Tech, SCJP, MCP
  • 2. Java Write Once, Run Anywhere IN ANY PLATFORMONE SOURCE CODE
  • 3. Java : Components Editor: Write the source code. Linker: Link the Source code with the library files. Java Compiler – Keyword javac use as convert Java source code to bytecode. Bytecode - An intermediate form, known as native code, closer to machine code. JVM-Java Virtual Machine , a concept of target platform which interprets the bytecode. Interpreter-The interpreter demonstrates the platform independent .class file to equivalent machine dependent code to run. Keyword java. Javadoc-API Documentation generator. JRE- Java Runtime Environment.
  • 4. Java : Features JVM uses bytecodes as .class file. Light-weight Small binary class files for fast execution. Just-in-time (JIT) Compilers for compiling only changes code. Multithreading for high process and memory management. Native Methods Interfaces as JNDI. Native Methods Libraries.
  • 5. Java : Features (Cont..) Class Loader. Dynamic. Good communication constructs. Secure. Portable and Compatible. Understandable and easy-to-write. Fully Object Oriented. Support Console based, Windows based and Web based application. Case-sensitive. JRE. Jdk (Java Development toolkit).
  • 6. General Language Features C/C++ like syntax, ends with ; No pointers concept. Objects taken all controls. Objects communicates with objects through messages. Messages result in invocation of class methods.
  • 7. Java : Security Language designed as safe. Strict compiler javac & JIT. Dynamic Runtime Loading (Verifier). Runtime Security Manager. Jar- Create & manage all the java archive files. Method area. Heap. JVM language stacks. Pc registers. Native method stacks. Java kernel.
  • 8. Security Manager Prevents unauthorized disk read/writes. Restricts network access without creating dynamic link library files. Restricts Other access (native methods). Implementation is browser or processor dependent.
  • 9. Object Oriented Languages Comparison with java C++ Objective C Ada Java Encapsulation Yes Yes Yes Yes Inheritance Yes Yes No Yes Multiple Inheritance Yes Yes No No Polymorphism Yes Yes Yes Yes Binding (Early/Late) Both Both Early Both Concurrency Poor Poor Difficult Yes Garbage Collection No Yes No Yes Genericity Yes No Yes No Class Libraries Yes Yes Limited Yes FEATURES
  • 10. Features Removed From C++ Operator overloading. Pointers of Array/pointers. Multiple-inheritance of implementation through class inherit concept. Enum, typedef, #define. Copy constructors, destructors. Templates. And many more....
  • 11. Added or Improved over C++ Interfaces over class. Garbage collection. Exceptions (More featureful than C++). Strings and many implementation. Instanceof. Package. Multi-threads.
  • 12. Java better than C++ No Typedefs, Defines, or Preprocessor. No Global Variables. No goto statement. No Pointers. No Unsafe Structures. No Multiple Inheritance. No Operator Overloading. No Automatic Coercions. No Fragile Data Types. No copy constructor.
  • 13. Basic Data Types Data Types boolean either true of false char 16 bit Unicode 1.1 byte 8-bit integer (signed) short 16-bit integer (signed) int 32-bit integer (signed) long 64-bit integer (signed) float 32-bit floating point double 64-bit floating point String (class for manipulating strings) String, StringBuilder, StringBuffer, StringTokenizer  Java uses Unicode to represent characters internally.
  • 14. Java Integrates Power of Compiled Languages and Flexibility of Interpreted Languages  Applet.  Swing & Layout Manager.  Hibernate.  Struts.  Spring  Servlet  Java Server Pages (JSP)  Java Bean.  Enterprise Java Bean (EJB).  J2ME.  Junit.  & Many More.
  • 15. Power of Java and the Web Deliver .exe, not just .class. Remove porting. Remove end-user installation. Remove software distribution costs. Access by millions of customers through web.
  • 16. Applications : Types Different possibilities to write/run a Java codes are: Application- A stand-alone program that can be invoked from command line through console which has a “main” method. Applet- A program embedded in a web page , to be run when the page is browsed . A program that contains no “main” method. Application -Java interpreter Applets- Java enabled web browser (Linked to HTML via <APPLET> tag. in html file or run through Appletviewer).
  • 17. Java Bytecodes move locally or through network Java Source code (.java) Java Compiler Java Bytecode (.class ) Java Interpreter Just in Time Compiler Runtime System Class Loader Bytecode Verifier Java Class Libraries Operating System Hardware Java Virtual machine Runtime Environment Compile-time Environment Life Cycle of Java Code
  • 19. Java Development Kit javac – Name of the Java Compiler. java - Name of the Java Interpreter. jdb- Name of the Java Debugger. appletviewer - Name of the Tool to run the applets code and give Applet window. javap – Use to print the Java bytecodes. javaprof - Name of the Java profiler. javadoc - Name of the documentation generator. javah - Name of the creates C header files. Javak= Name of the Kernel of the java.
  • 20. Bytecode Verifier It Called when the class is first loaded in runtime environment by JRE. It Verifies the bytecodes meet certain set of properties. Verified code runs faster through JRE. After verification, interpreter defines memory layout. Release all memories through Garbage collector.
  • 21. Java Example : Hello World // HelloWorld.java: Hello World program class HelloWorld { public static void main(String args[]) { System.out.println(“Hello World of Java”); } }
  • 22. Program Processing for Output Compilation # javac HelloWorld.java outputs in HelloWorld.class Execution # java HelloWorld Hello World of Java #
  • 23. Simple Java Applet Example // HelloApplet.java: A sample applet import java.applet.*; public class HelloApplet extends Applet { public void paint(Graphics g) { g.drawString(“Hello Applet !”,250,250); } } Prints Hello Applet ! In Applet window At (250,250) (x,y) coordinate
  • 24. Execution of an Applet by HTML <HTML> <TITLE> Hello Applet </TITLE> <APPLET code=“HelloApplet.class” width=500 height=500 align=“right ”> </APPLET> </HTML>
  • 25. Mechanism of Applets Hello Applet HelloApplet Java <app= “HelloApplet ”> 4 APPLET Development “HelloApplet.java” At terminal The Web HelloApplet .class AT WEB SERVER 2 31 5 Create Applet tag in HTML document Accessing from Client The browser creates a new window and a new thread and then runs the code
  • 26. Sequence Diagram : Classic Web Perspective
  • 27. Sequence Diagram : Java Web Interaction
  • 28. Significance of downloading Applets Interaction with World wide web w3 consortium. Dynamic animated web page instead of static web pages. Applets react to users interactive application. Could not connect network activity. Do not create dynamic link library files in cookies.
  • 29. Used Java Main Packages java.lang (by default added) java.util java.io java.awt java.awt.image java.applet java.net java.sql