Java Unit - 1 - Part - 1
Java Unit - 1 - Part - 1
Unit - 1
What is Java
Java is an object-oriented programming language
developed by Sun Microsystems, a company best
known for its high-end Unix workstations. Modeled
after C++, the Java language was designed to be
small, simple, and portable across platforms and
operating systems.
Java is also a platform.
Any hardware or software environment in which
a program runs, is known as a platform. Since
Java has its own runtime environment (JRE) and
API, it is called platform.
JDK Editions
Java Standard Edition (J2SE)
J2SE can be used to develop client-side
standalone applications or applets.
No Global Variables
No Goto statements
No Pointers
No Unsafe Structures
No Multiple Inheritance
No Operator Overloading
No Automatic Coercions
Java Buzzwords
Simple:
Java is a simple Language because it contains
many features of other Languages like C and
C++ and removes complexity because it
doesn’t support pointers, storage classes, goto
statements and multiple inheritances.
Object oriented:
Java is purely an Object Oriented Programming
language i.e., all the code of the Java
language is written into the classes and objects.
Java Buzzwords
Distributed:
Java is a distributed language because,
because of its ability to share the data and
programs over the LAN.
Multithreaded:
A Java program can be divided into multiple
threads assigning different tasks for different
threads and have all the threads executing in
parallel.
Java Buzzwords
Dynamic:
The JVM maintains a lot of runtime information
about the program and the objects in the
program. Libraries are dynamically linked during
runtime.
Architecture Neutral:
Java follows “Write-once-run-anywhere”
approach. Java programs are compiled into
byte code format which does not depend on
any machine architecture but can be easily
translated into a specific machine by a JVM for
that machine.
Java Buzzwords
Portable:
in Java the size of the primitive data types are
machine independent. For example, an int in
Java is always a 32-bit integer, and float is
always a 32-bit IEEE 754 floating point number.
High performance:
Java programs are compiled to portable
intermediate form known as byte codes, rather
than to native machine level instructions and
JVM executes the byte codes on any machine
on which it is installed.
Java Buzzwords
Robust:
A Program or an application is said to be robust
(reliable) when it is able to give some response
in any kind of context. Java’s features help to
make the programs robust. Some of those
features are: type checking, exception
handling, etc
Secured:
Java provides data security through
encapsulation.
Types of Java Applications
Standalone Application
Itis also known as desktop application or window-
based application. An application that we need
to install on every machine such as media player,
antivirus etc. AWT and Swing are used in java for
creating standalone applications.
Web Application
An application that runs on the server side and
creates dynamic page, is called web
application. Currently, servlet, jsp, struts, jsf etc.
technologies are used for creating web
applications in java.
Types of Java Applications
Enterprise Application
An application that is distributed in nature, such
as banking applications etc. It has the
advantage of high level security, load balancing
and clustering. In java, EJB is used for creating
enterprise applications.
Mobile Application
An application that is created for mobile devices.
Currently Android and Java ME are used for
creating mobile applications.
An Overview of Java
Object-Oriented Programming:
Object-oriented programming (OOP) is at
the core of Java. In fact, all Java programs
are to at least some extent object-oriented.
Two Paradigms:
1. Process-Oriented Model
2. Object-oriented programming
An Overview of Java
Process-Oriented Model: This approach
characterizes a program as a series of linear
steps (that is, code). The process-oriented
model can be thought of as code acting on
data.
Object-oriented programming: This
approach organizes a program around its
data (that is, objects) and a set of well-
defined interfaces to that data. An object-
oriented program can be characterized as
data controlling access to code.
Abstraction
Hiding the implementation details from the
user, only the functionality will be provided
to the user.