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

History of Java

Java was created by James Gosling and his team at Sun Microsystems in the early 1990s. It was originally called Oak but was later renamed to Java. The first public release of Java was Java Development Kit 1.0 in 1996. Some key facts about the history and development of Java include: - Java was created to be a simple, object-oriented, distributed, and secure programming language. - It has undergone many versions and updates over the years with new features and capabilities added in each release. Major versions include Java 2 (1998), Java 5 (2004), Java 6 (2006), Java 7 (2011), and Java 8 (2014). - Java is platform independent, meaning code written

Uploaded by

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

History of Java

Java was created by James Gosling and his team at Sun Microsystems in the early 1990s. It was originally called Oak but was later renamed to Java. The first public release of Java was Java Development Kit 1.0 in 1996. Some key facts about the history and development of Java include: - Java was created to be a simple, object-oriented, distributed, and secure programming language. - It has undergone many versions and updates over the years with new features and capabilities added in each release. Major versions include Java 2 (1998), Java 5 (2004), Java 6 (2006), Java 7 (2011), and Java 8 (2014). - Java is platform independent, meaning code written

Uploaded by

manohar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 32

History of Java

Java language developed by company Sun Microsystems and creator is Jamesh Gosling.

Story behind development of Java


Sun Microsystems Started by group of the students who are studding in Standard University.
These people found the problem in their room with electronic consumable remote. That means
one electronic consumable control is not worked on another electronics consumable. These
people want to develop a common remote control which is controlling all the electronic
consumables so they contact James Gosling and requested for the projects. Sun Microsystems
started by group of students out of them one person also Indian whose name Vinode Khosla.

James Gosling and his team members given the project name as Green started in the year 1990
and common remote control completed in the year 1992.

The James Gosling team develop a new language called as OAK But this name is already
selected by some other company renamed as Java but java has no meaning representation of
Island in Indonesia. The unofficial abbreviation of java is Just another virtual analyzer
(JAVA).

Java Version History


Now a day 8 versions of java are released, which is listed below with realizing date.

 JDK Alpha and Beta (1995)


 JDK 1.0 (23rd Jan, 1996)
 JDK 1.1 (19th Feb, 1997)
 J2SE 1.2 (8th Dec, 1998)
 J2SE 1.3 (8th May, 2000)
 J2SE 1.4 (6th Feb, 2002)
 J2SE 5.0 (30th Sep, 2004)
 Java SE 6 (11th Dec, 2006)
 Java SE 7 (28th July, 2011)
 Java SE 8 (18th March, 2014)

Overview of Java
Java is one of the programming language or technology used for developing web applications.
Java language developed at SUN Micro Systems in the year 1995 under the guidance of James
Gosling and there team. Originally SUN Micro Systems is one of the Academic university
(Standford University Network)

Whatever the software developed in the year 1990, SUN Micro Systems has released on the
name of oak, which is original name of java (scientifically oak is one of the tree name). The
OAK has taken 18 months to develop.

The oak is unable to fulfill all requirements of the industry. So James Gosling again reviews this
oak and released with the name of java in the year 1995. Scientifically java is one of the coffee
seed name.

Java divided into three categories, they are

 J2SE (Java 2 Standard Edition)


 J2EE (Java 2 Enterprise Edition)
 J2ME (Java 2 Micro or Mobile Edition)

J2SE
J2SE is used for developing client side applications.

J2EE
J2EE is used for developing server side applications.

J2ME
J2ME is used for developing mobile or wireless application by making use of a predefined
protocol called WAP(wireless Access / Application protocol).

All versions of java


Java Version SE 7

J2SE 1.2 is called as Dolphin and it is released on 28 July, 2011.

Features

 Strings in switch Statement


 Type Inference for Generic Instance Creation
 Multiple Exception Handling
 Support for Dynamic Languages
 Try with Resources
 Java nio Package
 Binary Literals, underscore in literals
 Diamond Syntax
 Automatic null Handling

Java Version SE 6

J2SE 1.2 is called as Mustang and it is released on 11 December, 2006.


Features

 Scripting Language Support


 JDBC 4.0 API
 Java Compiler API
 Pluggable Annotations
 Native PKI, Java GSS, Kerberos and LDAP support.
 Integrated Web Services.
 Lot more enhancements.

J2SE Version 5.0

J2SE 1.2 is called as Tiger and it is released on 30 September, 2004.

Features

 Generics
 Enhanced for Loop
 Autoboxing/Unboxing
 Typesafe Enums
 Varargs
 Static Import
 Metadata (Annotations)
 Instrumentation

J2SE Version 1.4

J2SE 1.2 is called as Merlin and it is released on 6 February, 2002.


Features

 XML Processing
 Java Print Service
 Logging API
 Java Web Start
 JDBC 3.0 API
 Assertions
 Preferences API
 Chained Exception
 IPv6 Support
 Regular Expressions
 Image I/O API

J2SE Version 1.3

J2SE 1.2 is called as Kestrel and it is released on 8 May, 2000.


Features

 Java Sound
 Jar Indexing
 A huge list of enhancements in almost all the java area.

J2SE Version 1.2

J2SE 1.2 is called as playground and it is released on 8 December, 1998.

Features

 Collections framework.
 Java String memory map for constants.
 Just In Time (JIT) compiler.
 Jar Signer for signing Java ARchive (JAR) files.
 Policy Tool for granting access to system resources.
 Java Foundation Classes (JFC) which consists of Swing 1.0, Drag and Drop, and Java 2D class
libraries.
 Java Plug-in
 Scrollable result sets, BLOB, CLOB, batch update, user-defined types in JDBC.
 Audio support in Applets.

JDK Version 1.1

JDK 1.1 is released on 19 januray, 1997

Features

 JDBC (Java Database connectivity)


 Inner Classes
 Java Beans
 RMI (Remote Method Invocation)
 Reflection(introspection only)

JDK Version 1.0

JDK 1.0 is called as OAK, and it is released on 23 januray, 1996.

Features of Java
Features of a language are nothing but the set of services or facilities provided by the language
vendors to the industry programmers. Some important features of java are;
 Simple
 Platform Independent
 Architectural Neutral
 Portable
 Multi Threading
 Distributed
 Networked
 Robust
 Dynamic
 Secured
 High Performance
 Interpreted
 Object Oriented

1. Simple
It is simple because of the following factors:

 It is free from pointer due to this execution time of application is improve. [whenever we write
a Java program without pointers then internally it is converted into the equivalent pointer
program].
 It have Rich set of API (application protocol interface).
 It have Garbage Collector which is always used to collect un-Referenced (unused) Memory
location for improving performance of a Java program.
 It contains user friendly syntax for developing any applications.
2. Platform Independent
A program or technology is said to be platform independent if and only if which can run on all
available operating systems with respect to its development and compilation. (Platform
represents O.S).

3. Architectural Neutral

Architecture represents processor.

A Language or Technology is said to be Architectural neutral which can run on any available
processors in the real world without considering there architecture and vendor (providers)
irrespect to its development and compilation.
The languages like C, CPP are treated as architectural dependent.

4. Portable

If any language supports platform independent and architectural neutral feature known as
portable. The languages like C, CPP, Pascal are treated as non-portable language. It is a portable
language.
According to SUN microsystem.

5. Multithreaded

A flow of control is known as thread. When any Language execute multiple thread at a time that
language is known as multithreaded Language. It is multithreaded Language.

6. Distributed

Using this language we can create distributed applicationn. RMI and EJB are used for creating
distributed applications. In distributed application multiple client system are depends on multiple
server systems so that even problem occurred in one server will never be reflected on any client
system.
Note: In this architecture same application is distributed in multiple server system.

7. Networked

It is mainly design for web based applications, J2EE is used for developing network based
applications.

8. Robust

Simply means of Robust is strong. It is robust or strong Programming Language because of its
capability to handle Run-time Error, automatic garbage collection, lack of pointer concept,
Exception Handling. All these points makes It robust Language.

9. Dynamic

It support Dynamic memory allocation due to this memory wastage is reduce and improve
performance of application. The process of allocating the memory space to the input of the
program at a run-time is known as dynamic memory allocation, To programming to allocate
memory space by dynamically we use an operator called 'new' 'new' operator is known as
dynamic memory allocation operator.

10. Secure

It is more secured language compare to other language; In this language all code is covered into
byte code after compilation which is not readable by human.

11. High performance

It have high performance because of following reasons;

 This language uses Bytecode which is more faster than ordinary pointer code so Performance of
this language is high.
 Garbage collector, collect the unused memory space and improve the performance of
application.
 It have no pointers so that using this language we can develop an application very easily.
 It support multithreading, because of this time consuming process can be reduced to execute
the program.

12. Interpreted

It is one of the highly interpreted programming languages.

13. Object Oriented


It supports OOP's concepts because of this it is most secure language, for this topic you can read
our oop's concepts in detail.

How Java is Platform Independent


A programming language or technology is said to be platform independent if and only if which
can run on all available operating systems with respect to its development and compilation.
(Platform represents Operating System).

Java is a platform independent programming language, Because when you install jdk software on
your system then automatically jvm are install on your system. For every operating system
separate jvm is available which is capable to read .class file or byte code. When we compile
your java code then .class file is generated by javac compiler these code are readable by jvm and
every operating system have its own jvm so jvm is platform dependent but due to jvm java
language is become platform independent.

Note: Java is platform independent but jvm is platform dependent.

JVM Architecture in Java


JVM (Java Virtual Machine) is a software. It is a specification that provides Runtime
environment in which java bytecode can be executed.

Operation of JVM
JVM mainly performs following operations.

 Allocating sufficient memory space for the class properties.


 Provides runtime environment in which java bytecode can be executed
 Converting byte code instruction into machine level instruction.

JVM is separately available for every Operating System while installing java software so that
JVM is platform dependent.

Note: Java is platform Independent but JVM is platform dependent because every Operating
system have different-different JVM which is install along with JDK Software.

Class loader subsystem:


Class loader subsystem will load the .class file into java stack and later sufficient memory will
be allocated for all the properties of the java program into following five memory locations.
 Heap area
 Method area
 Java stack
 PC register
 Native stack

Heap area:

In which object references will be stored.

Method area

In which static variables non-static and static method will be stored.

Java Stack

In which all the non-static variable of class will be stored and whose address referred by object
reference.

Pc Register

Which holds the address of next executable instruction that means that use the priority for the
method in the execution process?

Native Stack

Native stack holds the instruction of native code (other than java code) native stack depends on
native library. Native interface will access interface between native stack and native library.

Execution Engine
Which contains Interpreter and JIT compiler whenever any java program is executing at the
first time interpreter will comes into picture and it converts one by one byte code instruction into
machine level instruction JIT compiler (just in time compiler) will comes into picture from the
second time onward if the same java program is executing and it gives the machine level
instruction to the process which are available in the buffer memory.

Note: The main aim of JIT compiler is to speed up the execution of java program.

What is JIT and Why use JIT

JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed
up the interpretation phase.
In the older version of java compilation phase is so faster than interpretation phase. Industry has
complained to the SUN Micro System saying that compilation phase is very faster and
interpretation phase is very slow.

So solve this issue, SUN Micro System has developed a program called JIT (just in time
compiler) and added as a part of JVM to speed up the interpretation phase. In the current version
of java interpretation phase is so faster than compilation phase. Hence java is one of the highly
interpreted programming languages.

Object and class in Java


Object is the physical as well as logical entity where as class is the only logical entity.

Class: Class is a blue print which is containing only list of variables and method and no memory
is allocated for them. A class is a group of objects that has common properties.

A class in java contains:

 Data Member
 Method
 Constructor
 Block
 Class and Interface

Object: Object is a instance of class, object has state and behaviors.

An Object in java has three characteristics:

 State
 Behavior
 Identity

State: Represents data (value) of an object.

Behavior: Represents the behavior (functionality) of an object such as deposit, withdraw etc.

Identity: Object identity is typically implemented via a unique ID. The value of the ID is not
visible to the external user. But,it is used internally by the JVM to identify each object uniquely.

Class is also can be used to achieve user defined data types.


Real life example of object and class

In real world many examples of object and class like dog, cat, and cow are belong to animal's
class. Each object has state and behaviors. For example a dog has state:- color, name, height, age
as well as behaviors:- barking, eating, and sleeping.

Vehicle class
Car, bike, truck these all are belongs to vehicle class. These Objects have also different different
states and behaviors. For Example car has state - color, name, model, speed, Mileage. as we;; as
behaviors - distance travel
Difference between Class and Object
Class Object

Class is a container which collection of


1 object is a instance of class
variables and methods.

No memory is allocated at the time of Sufficient memory space will be allocated for all the variables
2
declaration of class at the time of declaration.

One class definition should exist only


3 For one class multiple objects can be created.
once in the program.

Syntax to declare a Class


class Class_Name
{
data member;
method;
}

Simple Example of Object and Class


In this example, we have created a Employee class that have two data members eid and ename.
We are creating the object of the Employee class by new keyword and printing the objects value.
Example
class Employee
{
int eid; // data member (or instance variable)
String ename; // data member (or instance variable)
eid=101;
ename="Hitesh";
public static void main(String args[])
{
Employee e=new Employee(); // Creating an object of class Employee
System.out.println("Employee ID: "+e.eid);
System.out.println("Name: "+e.ename);
}
}

Output
Employee ID: 101
Name: Hitesh

Note: A new keyword is used to allocate memory at runtime, new keyword is used for create an
object of class, later we discuss all the way for create an object of class.

Data Type in Java


Datatype is a spacial keyword used to allocate sufficient memory space for the data, in other
words Data type is used for representing the data in main memory (RAM) of the computer.

In general every programming language is containing three categories of data types. They are

 Fundamental or primitive data types


 Derived data types
 User defined data types.
Primitive data types
Primitive data types are those whose variables allows us to store only one value but they never
allows us to store multiple values of same type. This is a data type whose variable can hold
maximum one value at a time.

Example
int a; // valid
a=10; // valid
a=10, 20, 30; // invalid

Here "a" store only one value at a time because it is primitive type variable.

Derived data types


Derived data types are those whose variables allow us to store multiple values of same type. But
they never allows to store multiple values of different types. These are the data type whose
variable can hold more than one value of similar type. In general derived data type can be
achieve using array.

Example
int a[] = {10,20,30}; // valid
int b[] = {100, 'A', "ABC"}; // invalid

Here derived data type store only same type of data at a time not store integer, character and
string at same time.

User defined data types


User defined data types are those which are developed by programmers by making use of
appropriate features of the language.

User defined data types related variables allows us to store multiple values either of same type or
different type or both. This is a data type whose variable can hold more than one value of
dissimilar type, in java it is achieved using class concept.

Note: In java both derived and user defined data type combined name as reference data type.

In C language, user defined data types can be developed by using struct, union, enum etc. In java
programming user defined datatype can be developed by using the features of classes and
interfaces.
Example
Student s = new Student();

In java we have eight data type which are organized in four groups. They are

 Integer category data types


 Character category data types
 Float category data types
 Boolean category data types

Integer category data types


These category data types are used for storing integer data in the main memory of computer by
allocating sufficient amount of memory space.

Integer category data types are divided into four types which are given in following table

Data Type Size Range

1 Byte 1 + 127 to -128

2 Short 2 + 32767 to -32768

3 Int 4 + x to - (x+1)

4 Long 8 + y to - (y+1)

Character category data types

A character is an identifier which is enclosed within single quotes. In java to represent character
data, we use a data type called char. This data type takes two byte since it follows Unicode
character set.

Data Type Size(Byte) Range

Char 2 232767 to -32768

Why Java take 2 byte of memory for store character ?


Java support more than 18 international languages so java take 2 byte for characters, because for
18 international language 1 byte of memory is not sufficient for storing all characters and
symbols present in 18 languages. Java supports Unicode but c support ascii code. In ascii code
only English language are present, so for storing all English latter and symbols 1 byte is
sufficient. Unicode character set is one which contains all the characters which are available in
18 international languages and it contains 65536 characters

Float category data types


Float category data type are used for representing float values. This category contains two data
types, they are in the given table

Data Type Size Range Number of decimal places

Float 4 +2147483647 to -2147483648 8

Double 8 + 9.223*1018 16

Boolean category data types


Boolean category data type is used for representing or storing logical values is true or false. In
java programming to represent Boolean values or logical values, we use a data type called
Boolean.

Why Boolean data types take zero byte of memory ?

Boolean data type takes zero bytes of main memory space because Boolean data type of java
implemented by Sun Micro System with a concept of flip - flop. A flip - flop is a general purpose
register which stores one bit of information (one true and zero false).

Note: In C, C++ (Turbo) Boolean data type is not available for representing true false values but
a true value can be treated as non-zero value and false values can be represented by zero

Data Type Default Value Default size

boolean false 1 bit

char '\u0000' 2 byte

byte 0 1 byte

short 0 2 byte

int 0 4 byte
long 0L 8 byte

float 0.0f 4 byte

double 0.0d 8 byte

Variable Declaration Rules in Java


Variable is an identifier which holds data or another one variable is an identifier whose value
can be changed at the execution time of program. Variable is an identifier which can be used to
identify input data in a program.

Syntax
Variable_name = value;

Rules to declare a Variable


 Every variable name should start with either alphabets or underscore ( _ ) or dollar ( $ )
symbol.
 No space are allowed in the variable declarations.
 Except underscore ( _ ) no special symbol are allowed in the middle of variable
declaration
 Variable name always should exist in the left hand side of assignment operators.
 Maximum length of variable is 64 characters.
 No keywords should access variable name.

Note: Actually a variable also can start with ¥,¢, or any other currency sign.

Example of Variable Declaration


class Sum
{
public static void main(String[] args)
{
int _a, ¢b, ¥c, $d, result;
_a=10;
¢b=20;
¥c=30;
$d=40;
result=_a+¢b+¥c+$d;
System.out.println("Sum is :" +result);
}
}

Output
Sum is : 100

Variable declarations
In which sufficient memory will be allocated and holds
default values.
Syntax
Datatype variable_name;
byte b1;

Variable initialization
It is the process of storing user defined values at the time of allocation of memory space.
Variable assignment
Value is assigned to a variable if that is already declared or initialized.

Syntax
Variable_Name = value
int a = 100;

Syntax
int a= 100;
int b;
b = 25; // ------> direct assigned variable
b = a; // ------> assigned value in term of variable
b = a+15; // ------> assigned value as term of expression

Operators in Java
Operator is a special symbol that tells the compiler to perform specific mathematical or logical
Operation. Java supports following lists of operators.

 Arithmetic Operators
 Relational Operators
 Logical Operators
 Bitwise Operators
 Assignment Operators
 Ternary or Conditional Operators
Arithmetic Operators
Given table shows all the Arithmetic operator supported by Java Language. Lets suppose
variable A hold 8 and B hold 3.

Operator Example (int A=8, B=3) Result


+ A+B 11
- A-B 5
* A*B 24
/ A/B 2
% A%4 0

Relational Operators
Which can be used to check the Condition, it always return true or false. Lets suppose variable A
hold 8 and B hold 3.

Operators Example (int A=8, B=3) Result


< A<B False
<= A<=10 True
> A>B True
>= A<=B False
== A== B False
!= A!=(-4) True
Logical Operator
Which can be used to combine more than one Condition?. Suppose you want to combined two
conditions A<B and B>C, then you need to use Logical Operator like (A<B) && (B>C). Here
&& is Logical Operator.

Operator Example (int A=8, B=3, C=-10) Result


&& (A<B) && (B>C) False
|| (B!=-C) || (A==B) True
! !(B<=-A) True

Truth table of Logical Operator


C1 C2 C1 && C2 C1 || C2 !C1 !C2
T T T T F F
T F F T F T
F T F T T F
F F F F T T

Assignment operators
Which can be used to assign a value to a variable. Lets suppose variable A hold 8 and B hold 3.

Operator Example (int A=8, B=3) Result


+= A+=B or A=A+B 11
-= A-=3 or A=A+3 5
*= A*=7 or A=A*7 56
/= A/=B or A=A/B 2
%= A%=5 or A=A%5 3
=a=b Value of b will be assigned to a

Ternary operator
If any operator is used on three operands or variable is known as ternary operator. It can be
represented with " ?: "

Ternary operator Read in detailRead in detail

Main() Method
main() method is starting execution block of a java program or any java program start their
execution from main method. If any class contain main() method known as main class.
Syntax of main() method:

Syntax
public static void main(String args[])
{
.......
.......
}

Public
public is a keyword in a java language whenever if it is preceded by main() method the scope is
available anywhere in the java environment that means main() method can be executed from
anywhere. main() method must be accessed by every java programmer and hence whose access
specifier must be public.

Static
static is a keyword in java if it is preceded by any class properties for that memory is allocated
only once in the program. Static method are executed only once in the program. main() method
of java executes only once throughout the java program execution and hence it declare must be
static.

Void
void is a special datatype also known as no return type, whenever it is preceded by main()
method that will be never return any value to the operating system. main() method of java is not
returning any value and hence its return type must be void.

String args[]
String args[] is a String array used to hold command line arguments in the form of String
values.
In case of main() method following changes are acceptable

1. We can declare String[] in any valid form.

 String[] args
 String args[]
 String []args

2. Instance of String[] we can take var-arg String parameter is String...

Syntax
main(String[] args) --> main(String... args)

3. We can change the order of modifiers i.e Instead of

Syntax
public static we can take static public

4. Instead of args we can take any valid java identifier.

Syntax
public static void main(String a[])

We can overload main() method ?


Yes, We can overload main() method. A Java class can have any number of main() methods. But
run the java program, which class should have main() method with signature as "public static
void main(String[] args). If you do any modification to this signature, compilation will be
successful. But, not run the java program. we will get the run time error as main method not
found.

Example of override main() method

Example
public class mainclass
{
public static void main(String[] args)
{
System.out.println("Execution starts from Main()");
}
void main(int args)
{
System.out.println("Override main()");
}
double main(int i, double d)
{
System.out.println("Override main()");
return d;
}
}

Output
Execution starts from Main()

Command line arguments


If any input value is passed through command prompt at the time of running of program is
known as command line argument by default every command line argument will be treated as
string value and those are stored in string array of main() method.

Syntax for Compile and Run CMD programs


Compile By -> Javac Mainclass.java
Run By -> Java Mainclass value1 value2 value3 ....................

Example of command-line argument in java


class CommandLineExample
{
public static void main(String args[])
{
System.out.println("Argument is: "+args[0]);
}
}

Compile and Run above programs


Compile By > Javac CommandLineExample.java
Run By > Java CommandLineExample Porter

Output
Argument is: Porter

Example of command-line argument in java


class SumDemo
{
public static void main(String args[])
{
System.out.println("Sum: "+args[0]);
}
}

Compile and Run above programs


Compile By > Javac SumDemo.java
Run By > Java SumDemo 10 20

Output
Sum: 30

When the above statement is executing the following sequence of steps will take place.

 Class loader sub-system loads SumDemo along with Command line argument(10, 20)
and in main memory.
 JVM take the loaded class SumDemo along with Command line arguments (10, 20) and
place the number of values in the length variable that is 2.
 JVM looks for main() that is JVM will place the Command in the main() in the form of
string class that is.

 Hence all the CMD line arguments of java are sending to main() method available in the
form of array of object of String class (every CMD are available or stored in main
method in the form of array of object of String class).
 JVM calls the main() method with respect to loaded class SumDemo that is
SumDemo.main().

Accept command line arguments and display their values


class CMD
{
public static void main(String k[])
{
System.out.println("no. of arguments ="+k.length);
for(int i=0;i< k.length;i++)
{
System.out.println(k[i]);
}
}
}

Note: Except + operator any numeric operation not allowed in command line arguments.

Square of Number by reading value from command prompt.


class squareDemo
{
int no, result;
void square(String s)
{
int no=Integer.parseInt(s);
result=no*no;
System.out.println("Square: " +result);
}
}
class CMD
{
public static void main(String args[])
{
System.out.println("no of arguments: "+args.length);
squareDemo obj=new squareDemo();
obj.square(args[0]);
}
}

You might also like