0% found this document useful (0 votes)
28 views

Introduction To Java Programming

This document introduces Java programming. It discusses the history of Java, key concepts like object-oriented programming, and Java's architecture which includes bytecode, the Java virtual machine, and class files. The Java API and language allow applications to take advantage of technologies like object-orientation, multi-threading, and garbage collection.

Uploaded by

Abhijit Roy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Introduction To Java Programming

This document introduces Java programming. It discusses the history of Java, key concepts like object-oriented programming, and Java's architecture which includes bytecode, the Java virtual machine, and class files. The Java API and language allow applications to take advantage of technologies like object-orientation, multi-threading, and garbage collection.

Uploaded by

Abhijit Roy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Chapter 1

Introduction to Java Programming


DAC – Aug 2008
Objectives
At the end of this session, you will be able to:
History of Java
State the kind of applications that can be developed using java
Describe the buzzwords of java
Describe the architecture of java
Distinguish between the two types of classloaders
DAC – Aug 2008
History of Java
Java, whose original name was Oak
Java was invented by James Gosling,Patric Naughton,
Chris Warth, Ed frank, and Mike Sherin at Sun
Microsystems, in 1991
The original impetus for java was not Internet
Language that could be used to create software be
embedded in various consumer devices
The primary motivation was the need for a platform-
independent language
DAC – Aug 2008
Buzzwords of Java
Simple
Small language [ large libraries ]
Small interpreter (40 k), but large runtime libraries( 175 k)
Object Oriented
Supports encapsulation, inheritance, abstraction, and
polymorphism.
Distributed
Libraries for network programming
Remote Method Invocation
DAC – Aug 2008
Buzzwords of Java
Secure
Difficult to break Java security mechanisms
Java Bytecode verification
Signed Applets
Architecture neutral
Java Bytecodes are interpreted by the JVM
Portable
Primitive data type sizes and their arithmetic behavior are
specified by the language
Libraries define portable interfaces
DAC – Aug 2008
Buzzwords of Java
Multithreaded
Threads are easy to create and use ( perhaps easier than any
other programming language)
Dynamic
Finding Runtime Type Information is easy
DAC – Aug 2008
The Architecture
Java's architecture arises out of four distinct but interrelated
technologies:
the Java programming language
the Java class file format
the Java Application Programming Interface
the Java virtual machine
DAC – Aug 2008
The Architecture
Compile time environment Run time Environment

A.java B.java C.java A.class B.class C.class

JVM
Java compiler

Object.class String.class
DAC – Aug 2008

A.class B.class C.class


The Java Virtual Machine
A Java virtual machine's main job is to load class files and
execute the byte codes they contain
Only those class files from the Java API that are actually needed
by a running program are loaded into the virtual machine
The byte codes are executed in an execution engine, which is
one part of the VM
DAC – Aug 2008
The Java Virtual Machine

Your program
The Java API
class files Class loader class files

Byte codes

Execution engine
DAC – Aug 2008

Basic block diagram of the Java virtual machine


The Java Virtual Machine

Your program The Java


class files Class loader
API
class files
Byte codes

Execution engine

Native method invocations


Host operating system

A Java virtual machine implemented in software on top of a


host operating system
DAC – Aug 2008
The Java .class file
The Java class file helps make Java suitable for networks
mainly in the areas of platform independence and network
mobility
Its role in platform independence is, serving as a binary form
for Java programs that is expected by the Java VM but
independent of underlying host platforms
The Java class file is a binary file that can run on any
hardware platform and OS that hosts the Java VM
DAC – Aug 2008
The Java .class file
A Java compiler translates the instruction of the Java source
files into byte codes,the “machine language” of the Java VM
The Java class file plays a critical role in Java’s architectural
support for network mobility. First, class files were designed
to be compact , so they can move quickly across a network
As java programs are dynamically linked and dynamically
extensible, class files can be downloaded as needed
DAC – Aug 2008
The Java API
The Java API is a set of runtime libraries that give you a
standard way to access the system resources of a host computer
When you run a Java program , the VM loads the the Java API
class files that are referred to by your program class files
The combination of all, loaded class files and any loaded DLL
constitutes the full program executed by the Java VM
DAC – Aug 2008
The Java API
The Java API class files provide a Java program with a standard ,
platform independent interface to the underlying host. To the
Java program, the API looks the same and behaves predictably
no matter what platform happens to be underneath
The internal design of the Java API is also geared toward
platform independence. For Example the GUI library of the Java
API, AWT, is deigned to facilitate the user interfaces that work
on all platforms
DAC – Aug 2008
The Java API

Java App.

Java methods (Java API)

Native methods (Dynamic Libraries)

Host Operating System


DAC – Aug 2008
The Java Programming Language

The Java language allows you to write programs that take


advantage of many software technologies:
object-orientation
multi-threading
structured error handling
garbage collection
dynamic linking
dynamic extension
DAC – Aug 2008
Garbage Collection
Avoids
Memory leakage
Memory corruption
Increases
Productivity
DAC – Aug 2008
Summary
In this session, you learnt to:
State the kind of applications that can be developed using java
Describe the buzzwords of java
Describe the architecture of java
Distinguish between the two types of classloaders
DAC – Aug 2008

You might also like