0% found this document useful (0 votes)
2 views11 pages

01 Introduction Java

This document outlines the objectives and key features of the Java programming language, including its history, execution model, and types of applications and components that can be developed. Java is an object-oriented, network-capable, robust, secure, and multi-threaded language that runs on the Java Virtual Machine (JVM) using bytecode. The document also discusses Java's evolution, platform compatibility, and various program types such as applications and applets.

Uploaded by

yuyutong20060724
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

01 Introduction Java

This document outlines the objectives and key features of the Java programming language, including its history, execution model, and types of applications and components that can be developed. Java is an object-oriented, network-capable, robust, secure, and multi-threaded language that runs on the Java Virtual Machine (JVM) using bytecode. The document also discusses Java's evolution, platform compatibility, and various program types such as applications and applets.

Uploaded by

yuyutong20060724
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

2025/2/21

Unit objectives
 Aftercompleting this unit, you should be
able to:
 Describe the history and properties of the Java
programming language
 Explain the Java execution model, including the
use of bytecode and the Java virtual machine
 Outline the types of programs and components
that can be built using Java

What is Java?
 Javais an object-oriented programming
language developed by Sun Microsystems
 Java has a set of standardized class
libraries that support predefined reusable
functionality
 Javahas a runtime environment that can
be embedded in Web browsers and
operating systems

1
2025/2/21

Goals of Java
 Javawas developed to solve several
problems with existing languages
 These issues had an important influence on
its development:
 Object-orientation
 Portability
 Performance
 Security
 Internationalization
 Distributed computing
 Dynamic systems

The Java programming language(1/4)


 Object-oriented
 Java supports software development using the
notion of objects
 Software developed using Java is composed of
classes and objects

 Network capable
 Java supports the development of distributed
applications
 Some types of Java applications are designed
to be accessed through a Web browser

2
2025/2/21

The Java programming language(2/4)


 Robust
 Many aspects of Java promote the
development of reliable software
 Java uses a pointer model which does not
allow direct access to memory; memory cannot
be overwritten

 Secure
 Java authentication is based on public-key
encryption methods
 Java’s pointer model protects private data in
objects and prevents unauthorized applications
from accessing data structures

The Java programming language(3/4)


 Multi-threaded
 Allows your program to run more than one task
at the same time

 Compiled and interpreted


 Source code is compiled into machine code for
the Java virtual machine (JVM) by the Java
compiler
 Machine code for the JVM is also known as
bytecode
 Interpreter of the Java virtual machine
interprets and executes instructions

3
2025/2/21

The Java programming language(4/4)


 Architecture neutral
 Bytecode instructions are architecture neutral
because they run on the JVM, and are not
specific to an architecture
 The same application runs on all platforms,
provided the Java virtual machine is installed
on that platform

 Portable at source and binary level


 One piece of source code gets compiled into
one set of bytecode instructions for the JVM,
and can be run on any platform and
architecture without recompiling the code

Java evolution(1/2)
 Java is a relatively young language
 It has been in use since 1995
 It was originally designed for consumer
electronic devices(TV, VCR, Freeze, Washing
Machine, Mobile Phone)
 Internet and Web was just emerging, so Sun
turned it into a language of Internet
Programming.
 It allows you to publish a webpage with Java
code in it.

 Java has a huge developer base


 There is a vast collection of libraries (from Sun
and other sources)

4
2025/2/21

Java evolution(2/2)

11

The Java Platform


A platform is a development or
deployment environment
 TheJava platform runs on any
operating system
 Other platforms are hardware
and vendor specific

 The Java platform provides:


 The Java virtual machine(JVM)
 Application Programming
Interface (API)

12

5
2025/2/21

The Java execution model


 Compiled language execution model
 Source code is compiled into instructions
understood by the host machine; host machine
executes this binary file

 Java execution model


 Source code is compiled into instructions
understood by the JVM; bytecode is then interpreted
by the JVM

13

Use of Java
 Java can be used to build programs and
software components
 Programs are stand-alone entities that can
run on the Java virtual machine
 Applications
 Applets

 Components are building blocks used to


create programs
 Servlets
 JavaServer Pages (JSPs)
 JavaBeans
 Enterprise JavaBeans (EJBs)
14

6
2025/2/21

Programs
 Application
 A stand-alone program that can access system
resources such as files
 Does not need to run in a Web browser
 Is explicitly invoked through the command line or
menu selection
 The method main() is the entry point for an
application

 Applet
 A Java program that is embedded within a Web
page;almost always graphical
 Security limits access to system resources
 Code executes on the client inside a Web browser

15

Components(1/2)
 Servlet
 Handles requests from the Web browser and
returns responses
 Creates dynamic content on the server
 Runs inside an application server

 JavaServer Page (JSP)


 HTML page embedded with Java code
 Creates dynamic content on the server instead
of on the browser
 Runs inside an application server

16

7
2025/2/21

Components(2/2)
 JavaBeans
 Java code that has its properties, methods, and
events exposed to promote reuse among
developers
 Reusable software component that can be
manipulated visually in a builder tool

 Enterprise JavaBeans (EJB)


 Distributed objects that allow communication
between Java objects in different JVMs
 Encapsulate the business logic and model of
an application
 Run inside an application server

17

Demo
A Simple Java Program
 (GUI) Displaying Text in a Message Dialog Box

18

8
2025/2/21

A Simple Java Program

19

A Simple Java Program


 Creating, Compiling, and Executing a Java
Program

20

9
2025/2/21

(GUI) Displaying Text in a Message Dialog Box

21

Checkpoint
 1. What is the JVM and what does it do?
 2. What is bytecode?
 3.What is the difference between a
program and a component?

23

10
2025/2/21

Unit summary
 In this module, you should have learned to:
 Describe the history and properties of the Java
programming language
 Explain the Java execution model, including the
use of bytecode and the Java virtual machine
 Outline the types of programs and components
that can be built using Java

24

11

You might also like