Sie sind auf Seite 1von 20

History Of Java

The history of Java is very interesting. Java was originally designed for interactive
television, but it was too advanced technology for the digital cable television industry
at the time. The history of java starts with Green Team. Java team members (also
known as Green Team), initiated this project to develop a language for digital
devices such as set-top boxes, televisions, etc. However, it was suited for internet
programming. Later, Java technology was incorporated by Netscape.

The principles for creating Java programming were "Simple, Robust, Portable,
Platform-independent, Secured, High Performance, Multithreaded, Architecture
Neutral, Object-Oriented, Interpreted and Dynamic".

Currently, Java is used in internet programming, mobile devices, games, e-business


solutions, etc. There are given the significant points that describe the history of Java.

1) James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java
language project in June 1991. The small team of sun engineers called Green Team.
2) Originally designed for small, embedded systems in electronic appliances like set-
top boxes.

3) Firstly, it was called "Greentalk" by James Gosling, and file extension was .gt.

4) After that, it was called Oak and was developed as a part of the Green project.

Why Java named "Oak"?

5) Why Oak? Oak is a symbol of strength and chosen as a national tree of many
countries like U.S.A., France, Germany, Romania, etc.

6) In 1995, Oak was renamed as "Java" because it was already a trademark by Oak
Technologies.

Why Java Programming named "Java"?

7) Why had they chosen java name for java language? The team gathered to
choose a new name. The suggested words were "dynamic", "revolutionary", "Silk",
"jolt", "DNA", etc. They wanted something that reflected the essence of the
technology: revolutionary, dynamic, lively, cool, unique, and easy to spell and fun to
say.

According to James Gosling, "Java was one of the top choices along with Silk". Since
Java was so unique, most of the team members preferred Java than other names.

8) Java is an island of Indonesia where first coffee was produced (called java coffee).

9) Notice that Java is just a name, not an acronym.

10) Initially developed by James Gosling at Sun Microsystems (which is now a


subsidiary of Oracle Corporation) and released in 1995.

11) In 1995, Time magazine called Java one of the Ten Best Products of 1995.

12) JDK 1.0 released in(January 23, 1996).

Java Version History


Many java versions have been released till now. The current stable release of Java is
Java SE 10.
1. JDK Alpha and Beta (1995)
2. JDK 1.0 (23rd Jan 1996)
3. JDK 1.1 (19th Feb 1997)
4. J2SE 1.2 (8th Dec 1998)
5. J2SE 1.3 (8th May 2000)
6. J2SE 1.4 (6th Feb 2002)
7. J2SE 5.0 (30th Sep 2004)
8. Java SE 6 (11th Dec 2006)
9. Java SE 7 (28th July 2011)
10. Java SE 8 (18th March 2014)
11. Java SE 9 (21st Sep 2017)
12. Java SE 10 (20th March 2018)
Paradigm Of Java
Paradigm can also be termed as method to solve some problem or do some task.
Programming paradigm is an approach to solve problem using some programming
language or also we can say it is a method to solve a problem using tools and
techniques that are available to us following some approach. There are lots for
programming language that are known but all of them need to follow some strategy
when they are implemented and this methodology/strategy is paradigms. Apart from
varieties of programming language there are lots of paradigms to fulfil each and
every demand. They are discussed below:

1. Imperative programming paradigm:


It is one of the oldest programming paradigm. It features close relation relation to
machine architecture. It is based on Von Neumann architecture. It works by
changing the program state through assignment statements. It performs step by step
task by changing state. The main focus is on how to achieve the goal. The paradigm
consist of several statements and after execution of all the result is stored.
Advantage:
1. Very simple to implement
2. It contains loops, variables etc.
Disadvantage:
1. Complex problem cannot be solved
2. Less efficient and less productive
3. Parallel programming is not possible
Imperative programming is divided into three broad categories: Procedural, OOP and
parallel processing. These paradigms are as follows:
1. Procedural programming paradigm –
This paradigm emphasizes on procedure in terms of under lying machine
model. There is no difference in between procedural and imperative approach.
It has the ability to reuse the code and it was boon at that time when it was in
use because of its reusability.
Then comes OOP,
2. Object oriented programming –
The program is written as a collection of classes and object which are meant for
communication. The smallest and basic entity is object and all kind of
computation is performed on the objects only. More emphasis is on data rather
procedure. It can handle almost all kind of real life problems which are today in
scenario.
Advantages:
 Data security
 Inheritance
 Code reusability
 Flexible and abstraction is also present
3. Parallel processing approach –
Parallel processing is the processing of program instructions by dividing them
among multiple processors. A parallel processing system posses many
numbers of processor with the objective of running a program in less time by
dividing them. This approach seems to be like divide and conquer. Examples
are NESL (one of the oldest one) and C/C++ also supports because of some
library function.
2. Declarative programming paradigm:
It is divided as Logic, Functional, Database. In computer science the declarative
programming is a style of building programs that expresses logic of computation
without talking about its control flow. It often considers programs as theories of some
logic. It may simplify writing parallel programs. The focus is on what needs to be
done rather how it should be done basically emphasize on what code is actually
doing. It just declare the result we want rather how it has be produced. This is the
only difference between imperative (how to do) and declarative (what to do)
programming paradigms. Getting into deeper we would see logic, functional and
database.
1. Logic programming paradigms –
It can be termed as abstract model of computation. It would solve logical
problems like puzzles, series etc. In logic programming we have a knowledge
base which we know before and along with the question and knowledge base
which is given to machine, it produces result. In normal programming
languages, such concept of knowledge base is not available but while using the
concept of artificial intelligence, machine learning we have some models like
Perception model which is using the same mechanism.
In logical programming the main emphasize is on knowledge base and the
problem. The execution of the program is very much like proof of mathematical
statement, e.g., Prolog
2. Functional programming paradigms –
The functional programming paradigms has its roots in mathematics and it is
language independent. The key principal of this paradigms is the execution of
series of mathematical functions. The central model for the abstraction is the
function which are meant for some specific computation and not the data
structure. Data are loosely coupled to functions. The function hide their
implementation. Function can be replaced with their values without changing
the meaning of the program. Some of the languages like perl, javascript mostly
uses this paradigm.
The next kind of approach is of Database.
3. Database/Data driven programming approach –
This programming methodology is based on data and its movement. Program
statements are defined by data rather than hard-coding a series of steps. A
database program is the heart of a business information system and provides
file creation, data entry, update, query and reporting functions. There are
several programming languages that are developed mostly for database
application. For example SQL. It is applied to streams of structured data, for
filtering, transforming, aggregating (such as computing statistics), or calling
other programs. So it has its own wide application.
Packages Of Java
 Java.lang package in Java
Provides classes that are fundamental to the design of the Java programming
language. The most important classes are Object, which is the root of the class
hierarchy, and Class, instances of which represent classes at run time.
Following are the Important Classes in Java.lang package :
 Boolean: The Boolean class wraps a value of the primitive type boolean in an
object.
 Byte: The Byte class wraps a value of primitive type byte in an object.
 Character – Set 1, Set 2: The Character class wraps a value of the primitive
type char in an object.
 Character.Subset: Instances of this class represent particular subsets of the
Unicode character set.
 Character.UnicodeBlock: A family of character subsets representing the
character blocks in the Unicode specification.
 Class – Set 1, Set 2 : Instances of the class Class represent classes and
interfaces in a running Java application.
 ClassLoader: A class loader is an object that is responsible for loading classes.
 ClassValue: Lazily associate a computed value with (potentially) every type.
 Compiler: The Compiler class is provided to support Java-to-native-code
compilers and related services.
 Double: The Double class wraps a value of the primitive type double in an
object.
 Enum: This is the common base class of all Java language enumeration types.
 Float: The Float class wraps a value of primitive type float in an object.
 InheritableThreadLocal: This class extends ThreadLocal to provide
inheritance of values from parent thread to child thread: when a child thread is
created, the child receives initial values for all inheritable thread-local variables
for which the parent has values.
 Integer :The Integer class wraps a value of the primitive type int in an object.
 Long: The Long class wraps a value of the primitive type long in an object.
 Math – Set 1, Set 2: The class Math contains methods for performing basic
numeric operations such as the elementary exponential, logarithm, square root,
and trigonometric functions.
 Number: The abstract class Number is the superclass of classes BigDecimal,
BigInteger, Byte, Double, Float, Integer, Long, and Short.
 Object: Class Object is the root of the class hierarchy.
 Package: Package objects contain version information about the
implementation and specification of a Java package.
 Process: The ProcessBuilder.start() and Runtime.exec methods create a native
process and return an instance of a subclass of Process that can be used to
control the process and obtain information about it.
 ProcessBuilder: This class is used to create operating system processes.
 ProcessBuilder.Redirect: Represents a source of subprocess input or a
destination of subprocess output.
 Runtime: Every Java application has a single instance of class Runtime that
allows the application to interface with the environment in which the application
is running.
 RuntimePermission: This class is for runtime permissions.
 SecurityManager: The security manager is a class that allows applications to
implement a security policy.
 Short: The Short class wraps a value of primitive type short in an object.
 StackTraceElement: An element in a stack trace, as returned by
Throwable.getStackTrace().
 StrictMath- Set1, Set2: The class StrictMath contains methods for performing
basic numeric operations such as the elementary exponential, logarithm,
square root, and trigonometric functions.
 String- Set1, Set2: The String class represents character strings.
 StringBuffer: A thread-safe, mutable sequence of characters.
 StringBuilder: A mutable sequence of characters.
 System: The System class contains several useful class fields and methods.
 Thread: A thread is a thread of execution in a program.
 ThreadGroup: A thread group represents a set of threads.
 ThreadLocal: This class provides thread-local variables.
 Throwable: The Throwable class is the superclass of all errors and exceptions
in the Java language.
 Void: The Void class is an uninstantiable placeholder class to hold a reference
to the Class object representing the Java keyword void.
 Java.io Package in Java
This package provides for system input and output through data streams,
serialization and the file system. Unless otherwise noted, passing a null argument to
a constructor or method in any class or interface in this package will cause a
NullPointerException to be thrown.

 Java.util Package
This Java package, java.util, contains a collection of utility classes. Among them are
several generic data structures (Dictionary, Stack, Vector, Hash Table) a useful
object for tokenizing a string and another for manipulating calendar dates.
The java.util package also contains the Observer interface and Observable class
which allows objects to notify one another when they change.

 Java Networking Package


The java.net package contains classes and interface definitions that implement various networking
capabilities. The Classes in this package include a class that implement a URL, a connection to a URL,
a socket connection, and a datagram packet. You can use these classes to implement client-server
applications and other networking communication applications. Custom Networking and Security
has several examples using these classes, including a client-server example and an example that uses
datagrams.

 The Applet Package


This package contains the Applet class, the class that you must subclass if you're writing an applet.
Included in this package is the Audio Clip interface which provides a very high level abstraction of
audio. Writing Applets explains the ins and outs of developing your own applets.

 The Abstract Window Toolkit Packages


Three packages comprise the Abstract Window Toolkit: java.awt, java.awt.image, java.awt.peer.

1. AWT Package: The java.awt package provides graphical user interface (GUI) elements that
are used to get input from and display information to the user. These elements include
windows, buttons, scrollbars, and text items.
2. AWT Image Package: The java.awt.image package contains classes and interfaces for
managing image data, such as setting the colour model, cropping, colour filtering, setting
pixel values, and grabbing snapshots of the screen.
3. AWT Peer Package: The java.awt.peer package contains classes and interfaces that connect
platform-independent AWT components to their platform-dependent implementation (such
as Motif widgets or Microsoft Windows controls). Creating a User Interface covers all three
of the AWT packages.
Java AWT Hierarchy
The hierarchy of Java AWT classes are given below.
Java Applet
Applet is a Java program that can be embedded into a web page. It runs inside the
web browser and works at client side. Applet is embedded in a HTML page using the
APPLET or OBJECT tag and hosted on a web server.
Applets are used to make the web site more dynamic and entertaining.
Some important points :
1. All applets are sub-classes (either directly or indirectly)
of java.applet.Applet class.
2. Applets are not stand-alone programs. Instead, they run within either a web
browser or an applet viewer. JDK provides a standard applet viewer tool called
applet viewer.
3. In general, execution of an applet does not begin at main() method.
4. Output of an applet window is not performed by System.out.println(). Rather it is
handled with various AWT methods, such as drawString().
Life cycle of an applet :

It is important to understand the order in which the various methods shown in the
above image are called. When an applet begins, the following methods are called, in
this sequence:
1. init( )
2. start( )
3. paint( )
When an applet is terminated, the following sequence of method calls takes place:
1. stop( )
2. destroy( )
Let’s look more closely at these methods.
1. init( ) : The init( ) method is the first method to be called. This is where you
should initialize variables. This method is called only once during the run time
of your applet.
2. start( ) : The start( ) method is called after init( ). It is also called to restart an
applet after it has been stopped. Note that init( ) is called once i.e. when the
first time an applet is loaded whereas start( ) is called each time an applet’s
HTML document is displayed onscreen. So, if a user leaves a web page and
comes back, the applet resumes execution at start( ).
3. paint( ) : The paint( ) method is called each time an AWT-based applet’s
output must be redrawn. This situation can occur for several reasons. For
example, the window in which the applet is running may be overwritten by
another window and then uncovered. Or the applet window may be minimized
and then restored.
paint( ) is also called when the applet begins execution. Whatever the cause,
whenever the applet must redraw its output, paint( ) is called.
The paint( ) method has one parameter of type Graphics. This parameter will
contain the graphics context, which describes the graphics environment in
which the applet is running. This context is used whenever output to the applet
is required.
4. stop( ) : The stop( ) method is called when a web browser leaves the HTML
document containing the applet—when it goes to another page, for example.
When stop( ) is called, the applet is probably running. You should use stop(
) to suspend threads that don’t need to run when the applet is not visible. You
can restart them when start( ) is called if the user returns to the page.
5. destroy( ) : The destroy( ) method is called when the environment determines
that your applet needs to be removed completely from memory. At this point,
you should free up any resources the applet may be using. The stop( ) method
is always called before destroy( ).

Advantages:
 Displaying dynamic web pages of a web application.
 Playing sound files.
 Displaying documents
 Playing animations

Disadvantages:
1. An applet cannot load libraries or define native methods.
2. An applet cannot ordinarily read or write files on the execution host.
3. An applet cannot read certain system properties.
4. An applet cannot make network connections except to the host that it came from.
5. An applet cannot start any program on the host that’s executing it.
Java VS. C++
Difference Between C++ and Java
Parameter C++ Java
Relationship No strict relationship between class The strict relationship is enforced,
names and filenames. In C++, e.g., the source code for class
header files and implementation files PayRoll has to be in PayRoll.java.
are used for specific class.
Input I/O statements use in and cout, e.g., I/O input mechanism is a quite
mechanism in » x; cout« y; complex as it reads one byte at a
time (System.in). Output is easy,
e.g. System.out.println(x);
Complier and C++only support compiler Java supports both compiler and
Interpreter interpreter
compatibility Compatible with C source code, No backward compatibility with any
with other except some exceptional cases. previous language. The syntax is
languages influenced by C/C++.
Access control Flexible model with constant The cumbersome model
and object protection available encourages week encapsulation.
protection
Concept Write once compile anywhere Write once run anywhere
everywhere
Support for Allows both procedural Support object-oriented
programming programming and object-oriented programming model.
type programming.
Interface Allows direct calls to native system Only call through the Java Native
libraries. Interface and recently Java Native
Access
Memory Accessible to programmer System controlled
management
Root hierarchy C++ there is no such root hierarchy. Java is a pure object-oriented
C++ supports both procedural and Programming language. That's.
object-oriented programming; Why It follows single root
therefore, it is called a hybrid hierarchy.
language.
Best features C++ supports Object-oriented Java support automatic garbage
features Procedural programming collection. It does not support
features. destructors as C++ does.
Goto C++ has a goto statement. Java has no goto statement. The
Statement Although, it is not ideal to a use a keywords got, and const are
goto statement. reserved even if they are not used.
Multiple C++ provide multipleInheritance. Java doesn't provide multiple
inheritance The keywordvirtual is used to inheritance.
resolveproblems during
multipleinheritance if there is any.
Scope C++ has scope resolution operator (: No scope resolution operator (: :)
resolution :) which is used to define a method in Java. The method definitions
operator outside of a class and to access a have to occur within a class, so
global variable within from the scope there is no need for scope
where a local variable also exists resolution.
with the same name.
Use of try and In C++, you can't include the In Java, Exception handling is
catch try/catch even if the function throws different because there are no
an exception. destructors. Also, in Java, try/catch
must be defined if the function
declares that it may throw an
exception
Supporting C++ supports both method Java only supports method
method overloading & operator overloading overloading. It does not provide
support for operator overloading.
Portability The source must be recompiled for Bytecode classes are transferrable
the platform; hence the code is not to platform-specific JVM's.
portable.
Type Consistent between primitive and Differ for primitive and object
semantics object types. types.
Libraries Predominantly low-level functionality Massive, classes for high-level
services.
Runtime error Programmer responsibility. System Responsibility.
detection
Supports Points, structure, and union. Threads and interfaces.
Functions & Functions and data may exist All function and data exist within
Data external to any class, global and classes; package scope are
namespace scopes are available. available.
Platform C++ programs are platform Java programs are platform
dependent. They need to be independent. Java programs are
compiled for a particular platform. written for Java Virtual Machine
(JVM). It will run without needing
recompilation.
Runtime error In C++, It is Programmer It is system responsibility to check
detection responsibility to check the errors. error in the program.
Pointer C++ support pointers. Java offers only limited support for
pointers.
Structure It supports structures. It does not any support for
structures.
Unions C++ supports unions. Java does not support unions.
Object C++ supports manual object Java is heavy depend on
management management with the help of new automatic garbage collection. It
and delete keywords. does not support destructors.

Conclusion:
 C++ is object-oriented programming (OOP) language
 Java is programming language developed by Sun Microsystems
 Bjarne Stroustrup developed C++ at AT & T Bell Laboratories in
Murray Hil.
 The Java language was initially called OAK. Originally, it was
developed for handling devices and set-top boxes.
 No strict relationship between class names and filenames. In C++,
header files and implementation files are used for specific class.
 The strict relationship is enforced, e.g., the source code for class
PayRoll has to be in PayRoll.java.
Features Of Java
The primary objective of Java programming language creation was to make it portable,
simple and secure programming language. Apart from this, there are also some excellent
features which play an important role in the popularity of this language. The features of
Java are also known as java buzzwords.

A list of most important features of Java language is given below.

1. Simple
2. Object-Oriented
3. Portable
4. Platform independent
5. Secured
6. Robust
7. Architecture neutral
8. Interpreted
9. High Performance
10. Multithreaded
11. Distributed
12. Dynamic

Simple
Java is very easy to learn, and its syntax is simple, clean and easy to understand.
According to Sun, Java language is a simple programming language because:

o Java syntax is based on C++ (so easier for programmers to learn it after C++).
o Java has removed many complicated and rarely-used features, for example,
explicit pointers, operator overloading, etc.
o There is no need to remove unreferenced objects because there is an Automatic
Garbage Collection in Java.

Object-oriented
Java is an object-oriented programming language. Everything in Java is an object.
Object-oriented means we organize our software as a combination of different types of
objects that incorporates both data and behavior.
Object-oriented programming (OOPs) is a methodology that simplifies software
development and maintenance by providing some rules.

Basic concepts of OOPs are:

1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation

Platform Independent

Java is platform independent because it is different from other languages like C, C++,
etc. which are compiled into platform specific machines while Java is a write once, run
anywhere language. A platform is the hardware or software environment in which a
program runs.

There are two types of platforms software-based and hardware-based. Java provides a
software-based platform.

The Java platform differs from most other platforms in the sense that it is a software-
based platform that runs on the top of other hardware-based platforms. It has two
components:

1. Runtime Environment
2. API(Application Programming Interface)

Java code can be run on multiple platforms, for example, Windows, Linux, Sun Solaris,
Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This
bytecode is a platform-independent code because it can be run on multiple platforms,
i.e., Write Once and Run Anywhere(WORA).

Secured
Java is best known for its security. With Java, we can develop virus-free systems. Java is
secured because:

o No explicit pointer
o Java Programs run inside a virtual machine sandbox
o Classloader: Classloader in Java is a part of the Java Runtime Environment(JRE)
which is used to load Java classes into the Java Virtual Machine dynamically. It
adds security by separating the package for the classes of the local file system
from those that are imported from network sources.
o Bytecode Verifier: It checks the code fragments for illegal code that can violate
access right to objects.
o Security Manager: It determines what resources a class can access such as
reading and writing to the local disk.

Java language provides these securities by default. Some security can also be provided
by an application developer explicitly through SSL, JAAS, Cryptography, etc.

Robust
Robust simply means strong. Java is robust because:

o It uses strong memory management.


o There is a lack of pointers that avoids security problems.
o There is automatic garbage collection in java which runs on the Java Virtual
Machine to get rid of objects which are not being used by a Java application
anymore.
o There are exception handling and the type checking mechanism in Java. All these
points make Java robust.

Architecture-neutral
Java is architecture neutral because there are no implementation dependent features, for
example, the size of primitive types is fixed.

In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and
4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for
both 32 and 64-bit architectures in Java.

Portable
Java is portable because it facilitates you to carry the Java bytecode to any platform. It
doesn't require any implementation.

High-performance
Java is faster than other traditional interpreted programming languages because Java
bytecode is "close" to native code. It is still a little bit slower than a compiled language
(e.g., C++). Java is an interpreted language that is why it is slower than compiled
languages, e.g., C, C++, etc.

Distributed
Java is distributed because it facilitates users to create distributed applications in Java.
RMI and EJB are used for creating distributed applications. This feature of Java makes us
able to access files by calling the methods from any machine on the internet.

Multi-threaded
A thread is like a separate program, executing concurrently. We can write Java programs
that deal with many tasks at once by defining multiple threads. The main advantage of
multi-threading is that it doesn't occupy memory for each thread. It shares a common
memory area. Threads are important for multi-media, Web applications, etc.

Dynamic
Java is a dynamic language. It supports dynamic loading of classes. It means classes are
loaded on demand. It also supports functions from its native languages, i.e., C and C++.

Java supports dynamic compilation and automatic memory management (garbage


collection).

Das könnte Ihnen auch gefallen