0% found this document useful (0 votes)
78 views14 pages

What Is Java Lecture1

Java is an object-oriented programming language and platform. It is simple, robust, platform-independent, and secure. Java applications can be desktop applications, web applications, enterprise applications, and mobile applications. There are four editions of Java: Java SE for programming, Java EE for enterprise applications, Java ME for mobile applications, and JavaFX for rich internet applications. Java was originally created in the 1990s and has evolved through many versions since then.

Uploaded by

faizan ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
78 views14 pages

What Is Java Lecture1

Java is an object-oriented programming language and platform. It is simple, robust, platform-independent, and secure. Java applications can be desktop applications, web applications, enterprise applications, and mobile applications. There are four editions of Java: Java SE for programming, Java EE for enterprise applications, Java ME for mobile applications, and JavaFX for rich internet applications. Java was originally created in the 1990s and has evolved through many versions since then.

Uploaded by

faizan ali
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 14

What is Java

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


oriented and secure programming language.

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.

Application
According to Sun, 3 billion devices run Java. There are many devices where Java is currently
used. Some of them are as follows:

1. Desktop Applications such as acrobat reader, media player, antivirus, Eclipse,


Netbeans and IntelliJ etc.
2. Commercial e-commerce websites
3. Scientific applications and financial applications like electronic trading system.
4. Web Applications such as irctc.co.in, javatpoint.com, etc.
5. Enterprise Applications such as banking applications.
6. Mobile: android apps
7. Embedded System are computer-based but unlike desktop computers and their
applications. An embedded system's computer is embedded in a device such as
ATMS, multi-function printer, mobile phones, Household appliances, such as
microwave ovens, washing machines
8. Robotics
9. Games, Minecraft etc.

Types of Java Applications


There are mainly 4 types of applications that can be created using Java programming:

1) Standalone Application

Standalone applications are also known as desktop applications or window-based


applications. These are traditional software that we need to install on every machine.
Examples of standalone application are Media player, antivirus, etc. AWT and Swing are
used in Java for creating standalone applications.
2) Web Application

An application that runs on the server side and creates a dynamic page is called a web
application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are
used for creating web applications in Java.

3) Enterprise Application

An application that is distributed in nature, such as banking applications, etc. is called


enterprise application. In Java, EJB is used for creating enterprise applications. EJB
(Enterprise Java Bean) is used to develop scalable, robust and secured enterprise
applications in java.

4) Mobile Application

An application which is created for mobile devices is called a mobile application. Currently,
Android and Java ME are used for creating mobile applications.

Java Platforms / Editions


There are 4 platforms or editions of Java:

1) Java SE (Java Standard Edition)


It is a Java programming platform. It includes Java programming APIs such as
java.lang, java.io, java.net, java.util, java.sql, java.math etc.

It includes core topics like OOPs, String, Regex, Exception, Inner classes, Multithreading,
I/O Stream, Networking, AWT, Swing, Reflection, Collection, etc.

2) Java EE (Java Enterprise Edition)


It is an enterprise platform which is mainly used to develop web and enterprise applications.
It is built on the top of the Java SE platform. It includes topics like Servlet, JSP, Web
Services, EJB, JPA, etc.

3) Java ME (Java Micro Edition)


It is a micro platform which is mainly used to develop mobile applications.

4) JavaFX
It is used to develop rich internet applications. It uses a light-weight user interface API(GUI
toolkit such as checkbox, radio button).
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. The developers of Java want to make it
simple because it has to work on electronics devices where less memory is available.

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

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.

Sun Microsystems was an American company. Sun was endowed in Feburary, 1982.The
institution is most popularly known for the development of JAVA language. It also created
the Solaris Operating System and the File System for Networks. Sun remarkably contributed
in the development of various technologies including RISC, UNIX, client and virtualized
computing. And then in the year 2009 it was declared that Sun will be acquired by Oracle.

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)

03377634169
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 with limited language constructs

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, structures, goto statement, multiple inheritance,
header files 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. platform independent means writing code in one operating system e.g windows
XP and execute it on other platforms e.g unix, linux. 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).OR Java byte code is not machine dependent i.e. it
can run on any machine with any processor and any operating system.
Different type of JVMS are available for different operating systems such as SUN JVM, Microsoft JVM
and IBM JVM.

Portable
If a program yields the same result on each machine then the program is called portable. Java Programs
are portable, which is the result of Java system independence nature. Java is portable because it
facilitates you to carry the Java bytecode to any platform. It doesn't require any
implementation.

Secured
Java is best known for its security. With Java, we can develop virus-free systems. So virus
threats can be eliminated or minimized by using Java. Java is secured because:

o No explicit pointer
o Java Programs run inside a virtual machine sandbox

o Class loader: Class loader 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 program is strong as they do not easily crash like C/C++
program. Java is robust because there are several reasons:
o It uses strong memory management.
o There is a lack of pointers that avoids security problems.
o Most of the C++ programs crash in the middle because of not allocating sufficient
memory or forgetting the memory to be freed by the program. Such problems will
not occur in Java as the user will not care about memory allocation and de-
allocation. 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 Java has excellent in-built exception handling feature which identifies the error and
handle it and the type checking mechanism (high Data type to lower data type) in
Java. All these points make Java robust.
o Exception is an error which occurs at random and abruptly terminates the program
for example loss of data. Overcoming such problem is called exception handling.No
harm will happen, if an exception occurs in Java.

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.

Distributed
Information can be distributed to various computers on a network with the help of Java
program. Using Java, we can capture information and distribute it to clients; this is possible
as Java can handle protocols like TCP/IP and UDP which are core communication protocols
used in internet.

Java is distributed because it facilitates users to create distributed applications in Java. Java
Distributed applications are applications that can be executed over the network. Java.net
provides built in classes to facilitate the development of distributed applications. RMI and
EJB technologies 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.

High-performance
Java is both interpreted and compiled language. We use both compiler and interpreter for
execution of Java programs, Interpreter for single statement and compiler for loop
statements, so, Both interpreter and JIT compiler work together to run the program, which
in turn increases the overall performance of Java program. It is still a little bit slower than a
compiled language (e.g., C++).

Multi-threaded
A thread represents an individual process to execute a group of statements. JVM uses
different threads to execute different blocks of code. Creating multiple threads is called
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. For instance,
You have created a java application via which u can listen a music, watching a video clip
and downloading certain file. It can be done by defining multiple threads for performing
different jobs at the same time.

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, Games, Web
applications, etc.

Dynamic
Java is a dynamic language i.e. new class and methods can be linked to the program at run
time, if the program needs them. 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+
+. Methods from C and C++ language can linked in java program at run time.

Java supports dynamic compilation and automatic memory management (garbage


collection).

Scalability: Java platform can be implemented on wide range of computers with various
levels of recourses from embedded devices to mainframe computers because java is
compact and platform independent.

Java Development Environment


A set-top box is a hardware device that allows a digital signal to be received, decoded
and displayed on a television. The signal can be a television signal or Internet data and
is received via cable or telephone connection.
In the past, set top boxes were mostly used for cable and satellite television. The STB
could deliver more channels than a television's own channel numbering system. It
received signals containing data for multiple channels and filtered out the channel a
user wanted to view.

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-dependent. Java is platform-independent.


independent

Mainly used for C++ is mainly used for system Java is mainly used for application
programming. programming. It is widely used in
window, web-based, enterprise and
mobile applications.

Design Goal C++ was designed for systems Java was designed and created as an
and applications programming. interpreter for printing systems but
It was an extension of C later extended as 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 Java doesn't support the goto


the goto statement. statement.

Multiple C++ supports multiple Java doesn't support multiple


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

Operator C++ supports operator Java doesn't support operator


Overloading overloading. overloading.

Pointers C++ supports pointers. You Java supports pointer internally.


can write pointer program in However, you can't write the pointer
C++. program in java. It means java has
restricted pointer support in java.

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

Call by Value C++ supports both call by Java supports call by value only. There
and Call by value and call by reference. is no call by reference in java.
reference

Structure and C++ supports structures and Java doesn't support structures and
Union unions. unions.

Thread Support C++ doesn't have built-in Java has built-in thread support.


support for threads. It relies on
third-party libraries for thread
support.

Documentation C++ doesn't support Java supports documentation comment


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

Virtual Keyword C++ supports virtual keyword Java has no virtual keyword. We can
so that we can decide whether override all non-static methods by
or not override a function. default. In other words, non-static
methods are virtual by default.

unsigned right C++ doesn't support >>> Java supports unsigned right shift >>>
shift >>> operator. operator that fills zero at the top for
the negative numbers. For positive
numbers, it works same like >>
operator.

Inheritance Tree C++ creates a new inheritance Java uses a single inheritance tree
tree always. 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 hardware. Java is not so interactive with


hardware.

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


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

Note
o Java doesn't support default arguments like C++.
o Java does not support header files like C++. Java uses the import keyword to include
different classes and methods

You might also like