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

Java Part I

Java is a programming language and platform developed by Sun Microsystems in 1995. It is a high-level, robust, object-oriented, and secure language. Originally called Oak, it was renamed Java due to a trademark conflict. Java runs on a Java Virtual Machine (JVM) as bytecode, making it platform-independent.

Uploaded by

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

Java Part I

Java is a programming language and platform developed by Sun Microsystems in 1995. It is a high-level, robust, object-oriented, and secure language. Originally called Oak, it was renamed Java due to a trademark conflict. Java runs on a Java Virtual Machine (JVM) as bytecode, making it platform-independent.

Uploaded by

Gauri Ovhale
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

What is Java

Java is a programming language and a platform. Java is a high level, robust, object
oriented and secure programming language.

Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the
year 1995. James Gosling is known as the father of Java. Before Java, its name was
Oak. Since Oak was already a registered company, so James Gosling and his team
changed the Oak name to Java.

Platform: Any hardware or software environment in which a program runs, is known as


a platform. Since Java has a runtime environment (JRE) and API, it is called a platform.

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) Initially designed for small, embedded systems in electronic appliances like set-top
boxes.

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

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

next → ← prev

History of Java
1. History of Java
2. Java Version History

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 the 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". Java was developed by James
Gosling, who is known as the father of Java, in 1995. James Gosling and his team
members started the project in the early '90s.
Currently, Java is used in internet programming, mobile devices, games, e-business
solutions, etc. There are given 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) Initially designed for small, embedded systems in electronic appliances like set-top
boxes.

3) Firstly, it was called "Greentalk" by James Gosling, and the 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 the U.S.A., France, Germany, Romania, etc.

6) In 1995, Oak was renamed as "Java" because it was already a trademark by Oak
Technologies.
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 Mar 2014)
11. Java SE 9 (21st Sep 2017)
12. Java SE 10 (20th Mar 2018)

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
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.

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).

C++ vs Java
There are many differences and similarities between the C++ programming language
and Java. A list of top differences between C++ and Java are given below:

Comparison Index C++ Java

Platform C++ is platform Java is platform-independent.


independent dependent.

Mainly used for C++ is mainly used Java is mainly used for
for system application programming. It
programming. is widely used in window,
web
based, enterprise and
mobile applications.
Design Goal C++ was designed Java was designed and
for systems and created as an interpreter for
applications printing
programming. It was systems but later extended as
an extension of C a support network
programming language. computing. It was designed
with a goal of
being easy to use and
accessible to a broader
audience.

Goto C++ supports the Java doesn't support the


goto statement. goto statement.

Multiple C++ supports Java doesn't support multiple


inheritance multiple inheritance through class. It
inheritance. can be achieved by interfaces
in
java.

Operator C++ supports Java doesn't support


Overloading operator operator overloading.
overloading.

Pointers C++ supports Java supports pointer


pointers. You can internally. However, you can't
write pointer write the

program in C++. pointer program in java. It


means java has restricted
pointer support in java.
Compiler and C++ uses compiler Java uses compiler and
Interpreter only. C++ is compiled interpreter both. Java source
and code is converted into
run using the bytecode at compilation
compiler which time. The
converts source code interpreter executes this
into machine code bytecode at runtime and
so, C++ is platform produces output. Java is
dependent. interpreted that is why it is
platform independent.

Call by Value C++ supports both Java supports call by value


and Call by call by value and call only. There is no call by
reference by reference in java.
reference.

Structure and C++ supports Java doesn't support


Union structures and unions. structures and unions.

Thread Support C++ doesn't have built Java has built-in thread support.
in support for threads.
It relies on third-party
libraries for thread
support.

Documentation C++ doesn't support Java supports


comment documentation documentation comment
comment. (/** ... */) to create
documentation for java
source code.

Virtual Keyword C++ supports virtual Java has no virtual keyword.


keyword so that we We can override all non-static
can decide whether methods by default. In other
or not words, non-static methods
override a function. are virtual by default.
unsigned right C++ doesn't support Java supports unsigned right
shift >>> >>> operator. shift >>> operator that fills
zero at the top for the
negative
numbers. For positive
numbers, it works same like
>> operator.

Inheritance C++ creates a new Java uses a single inheritance


Tree inheritance tree always. tree always because all classes
are the child of Object class in
java. The object class is the
root of the inheritance tree in
java.

Hardware C++ is nearer to Java is not so interactive


hardware. with hardware.

Object-oriented C++ is an object Java is also an object-oriented


oriented language. language. However, everything
However, in C (except fundamental types) is
language, single root an object in Java. It is a single
hierarchy is not root hierarchy as everything
possible. gets
derived from java.lang.Object.

Java OOPs Concepts


1. Object-Oriented Programming
2. Advantage of OOPs over Procedure-oriented programming language
3. Difference between Object-oriented and Object-based programming language.

In this page, we will learn about the basics of OOPs. Object-Oriented Programming is a
paradigm that provides many concepts, such as inheritance, data binding,
polymorphism, etc.

OOPs (Object-Oriented Programming System)


Object means a real-world entity such as a pen, chair, table, computer, watch, etc.
Object-Oriented Programming is a methodology or paradigm to design a program
using classes and objects. It simplifies software development and maintenance by
providing some concepts:
o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation

Object

Any entity that has state and behavior is known as an object.


For example, a chair, pen, table, keyboard, bike, etc. It can be
physical or logical.

An Object can be defined as an instance of a class. An object


contains an address and takes up some space in memory.
Objects can communicate without knowing the details of each
other's data or code. The only necessary thing is the type of
message accepted and the type of response returned by the
objects.

Example: A dog is an object because it has states like color,


name, breed, etc. as well as behaviors like wagging the tail,
barking, eating, etc.

Class
Collection of objects is called class. It is a logical entity.

A class can also be defined as a blueprint from which


you can create an individual object. Class doesn't
consume any space.

Inheritance

When one object acquires all the properties and


behaviors of a parent object, it is known as inheritance.
It provides code reusability. It is used to achieve
runtime polymorphism.

Polymorphism

If one task is performed in different ways, it is known


as polymorphism. For example: to convince the
customer differently, to draw something, for example,
shape, triangle, rectangle, etc.

In Java, we use method overloading and method


overriding to achieve polymorphism.

Another example can be to speak something; for


example, a cat speaks meow, dog barks woof,
etc.
Abstraction

Hiding internal details and showing functionality is


known as abstraction. For example phone call, we don't
know the internal processing.

In Java, we use abstract class and interface to achieve


abstraction.

Encapsulation

Binding (or wrapping) code and data together into a


single unit are known as encapsulation. For example, a
capsule, it is wrapped with different medicines.

A java class is the example of encapsulation. Java bean


is the fully encapsulated class because all the data
members are private here.

You might also like