0% found this document useful (0 votes)
19 views31 pages

Chapter 2-Introduction To Java

Uploaded by

Sasinikhila Jogi
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)
19 views31 pages

Chapter 2-Introduction To Java

Uploaded by

Sasinikhila Jogi
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/ 31

Java Programming Language

Introduction to Java

J V D Prasad
Assistant Professor, CSE Department
Overview

• What is Java?

• History of Java

• Where is Java used?

• Types of Java Applications

• Java Buzzwords
What is a Java?
• A general-purpose computer programming language designed
to produce programs that will run on any computer system.
History of Java
• James Gosling, Mike Sheridan, and Patrick Naughton

• Java was developed by Sun Microsystems in the early 1990’s.

• Later merged into Oracle Corporation.


• The history of java starts from Green Team.
Contd.
• Why Oak? Earlier name of java was “OAK”.
– Tree
– There was already a programming language called 'OAK',
so they decided to rename 'OAK'.
– "Dynamic", "revolutionary", "Silk", "jolt", "DNA"
– In 1995, Oak was renamed as "Java" because it was
already a trademark by Oak Technologies.
– After renaming ‘Oak’ to java they publicly released Java
on May,27,1995.

5
Why the Name “Java”?
• Java is an island of Indonesia where first coffee was
produced (called java coffee).
• Java is an Island Famous for Coffee seeds.
• In 1995, Time magazine called Java one of the Ten Best
Products of 1995.
Where it is used?
• Desktop Applications.
– A desktop application means any software that can be installed on a
single computer (laptop or a desktop) and used to perform specific
tasks such as acrobat reader, media player, antivirus etc.

• Web Applications.
– A web based application is a software package that can be accessed
through the web browser.

7
Types of Java Applications
• Standalone Application
– An application that we need to install on every machine.
• Web Application
– An application that runs on the server side and creates
dynamic page.
• Enterprise Application
– An application that is used to satisfy the needs of
an organization rather than individual users.
• Mobile Application
– An application that is created for mobile devices.
Where it is used?
• Mobile Applications.
– A mobile app is a software application designed to run on mobile
devices such as smartphones and tablet computers.

• Embedded Applications.
– A software application that permanently resides in an industrial or
consumer device.
Java Editions
• Three editions of java platform make it easier for software
developers, web developers, service providers and device
manufacturers to target the commercial market.
Java Versions
• JDK 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 7 updated ( February 2013 )
• Java SE 8 (March 2014 )
• Java SE 9 (March 2018)
Java Features/Buzzwords
• Java is a Simple
• Java is Platform Independent.
• Java is Compiled and Interpreted.
• Java is Portable.
• Java is a Dynamic Language.
• Java is Secured.
• Java is Robust.
• Java is a Distributed Language.
• Java is a Multithreaded Language.
• Java is Architectural Neutral.
• Java is High in Performance
• Java is a OOP Language.
Java is Simple
• Simplicity of Java is the professional programmers could learn it
quickly and use effectively. (Familiar)
• Java derives it Syntax from C language.
• Many of Java’s OOP Features adopted from C++.
• Java was designed to make it much easier to write bug free code. [
Bug Free System ]
• Efficient Memory management ( Automatic )
• Removed many confusing and/or rarely-used features e.g., structures,
unions, explicit pointers, typedef, operator overloading etc.
• Java Removes Complexity because it doesn’t use pointers, Storage
Classes and Goto Statements and java doesn’t support Multiple
Inheritance.
Java is Platform Independent
• The concept of Write-once-run-anywhere (known as the
Platform independent) is one of the important key feature of
java language that makes java as the most powerful language.

• The programs written on one platform can run on any platform


provided the platform must have the JVM.

• Java code can be run on multiple platforms e.g. Windows, Linux,


Sun Solaris, Mac/OS etc. Java code is compiled by the compiler and
converted into byte code. This bytecode is a platform independent
code because it can be run on multiple platforms i.e. Write Once
and Run Anywhere(WORA).
• Bytecode files generally have a .class extension.
Contd.

 Different JVM are


designed for different OS
and Hardware.

 JVM is a platform
dependent , Where Java is
Platform independent
Java is Robust
 Java has the strong memory allocation and automatic garbage
collection mechanism. (Automatic memory management and
garbage collection )

 It provides the powerful exception handling and type checking


mechanism as compare to other programming languages. (Strong
type checking mechanism)

 Compiler checks the program whether there any error and


interpreter checks any run time error and makes the system secure
from crash.
Java is Secured
• Java does not use memory pointers explicitly.

• Security manager determines the accessibility options of a class


like reading and writing a file to the local disk.

• Class loader: adds security by separating the package for the


classes of the local file system from those that are imported from
network sources.

• Java uses the public key encryption system to allow the java
applications to transmit over the internet in the secure encrypted
form.
Java is Compiled & Interpreted
• Java is a compiled programming language, but rather
than compile straight to executable machine code,
it compiles to an intermediate binary form called JVM
byte code. The byte code is then interpreted to run the
program.

• Compilation  Java’s JVM Specific. Byte Code


• Interpretation  Native CPU Specific. Executable Object
code
Java is Dynamic & Distributed
Dynamic
 While executing the java program the user can get the
required files dynamically from a local drive or from a
computer thousands of miles away from the user just by
connecting with the Internet.
Distributed
The widely used protocols like HTTP and FTP are developed
in java.
Internet programmers can call methods on these protocols
and can get access the files from any remote machine on the
internet rather than writing codes on their local system.
Java is Multithreaded
 Java is also a Multithreaded programming language.

 Multithreading means a single program having different


threads executing independently at the same time.

 Multiple threads execute instructions according to the


program code in a process or a program.

 Multithreading works the similar way as multiple processes


run on one computer.
Java is Architectural Neutral
 In the world of network it is essential that the applications must be
able to migrate easily to different computer systems.
 Not only to computer systems but to a wide variety of hardware
architecture and Operating system architectures as well.
 The Java compiler does this by generating byte code instructions, to
be easily interpreted on any machine and to be easily translated into
native machine code on the fly.
 The compiler generates an architecture-neutral object file format to
enable a Java application to execute anywhere on the network and
then the compiled code is executed on many processors, given the
presence of the Java runtime system.
Java is High in Performance

• In the beginning interpretation of byte code resulted


the performance slow but the advance version of
JVM uses the adaptive and just in time compilation
technique that improves the performance.

• JIT Compiler.
Java is Portable

• We may carry the java byte code to any


platform.

• The feature write-once-run-anywhere makes


the java language portable provided that the
system must have interpreter for the JVM.
JDK , JRE & JVM
• Java Development Kit
– JDK is an acronym for Java Development Kit. It physically exists. It contains
JRE + development tools + API.
• Java Compiler , Java Interpreter, Standard Class Libraries , JIT Compiler, Applet Viewer, Java
Debugger etc.

• Java Runtime Environment


– JRE is an acronym for Java Runtime Environment. It is used to provide runtime
environment. It is the implementation of JVM. It physically exists. It contains
set of libraries + other files that JVM uses at runtime.

• Java Virtual Machine


– JVM (Java Virtual Machine) is an abstract Machine. It is a specification that
provides runtime environment in which java byte code can be executed.
JRE Vs JDK
JRE JDK
(Java Runtime environment) (Java Development Kit)
It is an implementation of the Java Virtual It is a bundle of software that you can use
Machine* which actually executes Java programs. to develop Java based applications.

Java Runtime Environment is a plug-in needed for Java Development Kit is needed for
running java programs. developing java applications.
The JRE is smaller than the JDK so it needs less The JDK needs more Disk space as it
Disk space. contains the JRE along with various
development tools.
The JRE can be downloaded/supported freely The JDK can be downloaded/supported
from freely from
oracle.com oracle.com/technetwork/java/javase/down
loads/
It includes the JVM, Core libraries and other It includes the JRE, set of API classes,
additional components to run applications and Java compiler, Web start and additional
applets written in Java. files needed to write Java applets and
applications.
Java is Object Oriented
• Influenced by C++
• “Everything is an Object” Paradigm
• Fields and methods are closely tied to the object's real world
characteristics and behavior.
• Object-oriented programming(OOPs) is a methodology that
simplify software development and maintenance by
providing some rules.

• Basic concepts of OOPs are:


– Object
– Class
– Inheritance
– Polymorphism
– Abstraction
– Encapsulation
Differences C C++ Java
Procedural
Programming Approach Programming OOP OOP
Language
Executable in Native Compiled into Java byte
Compiled Source Code Code
Executable in Native Code
code
Managed, using a
Memory management Manual Done Manual Done
garbage collector
Yes, very commonly used,
Yes, very commonly No pointers; references are
Pointers but some form of
used. used instead.
references available too.
Preprocessor Yes Yes No
String Type Character arrays Character arrays, objects Objects

Complex Data Types Structures, unions Structures, unions, classes Classes

Single class
Inheritance N/A Multiple class inheritance inheritance, multiple
interface implementation
Operator Overloading N/A Yes No
Automatic coercions Yes, with warnings if Yes, with warnings if loss Not at all if loss could
(Conversion) loss could occur could occur occur; must cast explicitly
Goto Statement Yes Yes No

You might also like