1) Java is an object-oriented programming language that uses a Java Virtual Machine (JVM) to run programs on different platforms like Linux and Windows.
2) The Java APIs provide prebuilt classes that can be used in programs to simplify development.
3) Key features of Java include being simple, architecture-neutral, object-oriented, distributed, compiled, interpreted, statically typed, multi-threaded, garbage collected, portable, high-performance, robust, secure, and extensible.
2. Introduction to Java
J ava is an object oriented programming language..
A Java Virtual Machine (JVM) is used to run Java programs.The
JVM can be made to run on different platforms, like Linux and
Windows, so the same Java programs can run on computers with
different operating systems.
Write Once, Run Anywhere.
The Java Application Programming Interfaces (APIs, or class
libraries) are a set of prebuilt classes that you can use in your
own programs.
if the Java language is like a set of grammar rules in a spoken
language, then the APIs are dictionaries full of words that can be
3. Java is a general purpose, HLL developed by Sun MicroSystem
The Java programming language was developed by a small team of
engineers, known as the Green Team, who initiated the language in
1991.
The Java language was originally called OAK, and at the time it was
designed for handheld devices and set-top boxes.
Oak was unsuccessful and in 1995 Sun changed the name to Java and
modified the language to take advantage of the burgeoning
World Wide Web.
Later, in 2009, Oracle Corporation acquired Sun Microsystems and
took ownership of two key Sun software assets: Java and Solaris.
4. Advantage
Relatively Simple to Use
J ava is a high level language, which means Java abstracts away (i.e.
handles for you) most of the complex details of the machine
(computer) such as memory management, etc.
Scalability
Easier to Maintain
Java is a statically-typed language, which means your code will have to
be checked for errors before it can be built into an app
As a statically typed language, Java is faster than dynamically typed
languages because things are more clearly defined.
Optimized Performance
6. Java is not a purely Object-Oriented
Language?
It fails to support:
1. All predefined types are objects
2.All operations performed on objects must be only through
methods exposed at the objects.
In Java, we have predefined types as non-objects
The static keyword:When we declares a class as static
then it can be used without the use of an object in
Java.
7. JVM (Java Virtual Machine)
JVM (Java Virtual Machine) is an abstract machine. It
is a specification that provides runtime environment
in which java bytecode can be executed.
A specification where working of Java Virtual
Machine is specified. But implementation provider is
independent to choose the algorithm. Its
implementation has been provided by Sun and other
companies.
An implementation Its implementation is known as
JRE (Java Runtime Environment).
Runtime Instance Whenever you write java
command on the command prompt to run the java
class, an instance of JVM is created
8. JVM (Java Virtual Machine)
What it does
The JVM performs following operation:
1..Loads code
2.Verifies code
3.Executes code
4.Provides runtime environment
JVM provides definition for
1. Memory area
2.Class file format
3.Register set
4.Garbage-collected heap
10. 1) Classloader
Classloader is a subsystem of JVM that is used to load class
files.
2) Class(Method) Area
Class(Method) Area stores per-class structures such as the
runtime constant pool, field and method data, the code
for methods.
3) Heap
It is the runtime data area in which objects are allocated.
4) Stack
It holds local variables & partial results. Each thread has a
11. 5) Program Counter Register
PC (program counter) register. It contains the address of the
Java virtual machine instruction currently being executed.
6) Native Method Stack
It contains all the native methods used in the application.
7) Executive Engine
a. Virtual processor
b. Interpreter-Read bytecode stream then execute the
instructions
c. Just-In-Time Compiler-compiles parts of the byte code that
have similar functionality at the same time, and hence
reduces the amount of time needed for compilation.
15. ByteCode
Java compilation produces “bytecode”
Intermediate code readable by the VM.
Transferable across the Internet as applets.
VM interprets BC into instructions
Partly responsible for performance lag.
ByteCode produced on any platform may be executed on
any other platform which supports a VM.