DCIT 22 Computer Programming 1 Lecture 3

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

INTRODUCTION

TO JAVA
DCIT 22 – Computer
Programming 1
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 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
History of Java
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.
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.
History of Java
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.
History of Java
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.
History of Java
8. Java is an island of Indonesia where
the first coffee was produced (called java
coffee). It is a kind of espresso bean.
Java name was chosen by James Gosling
while having coffee near his office.

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.

History of
Java
12. JDK 1.0 released in(January 23, 1996). After the
first release of Java, there have been many
additional features added to the language. Now
Java is being used in Windows applications, Web
applications, enterprise applications, mobile
applications, cards, etc. Each new version adds the
new features in Java.
Java Version History
Many java versions have been released till now. The current stable release of Java is Java SE 10.
• JDK Alpha and Beta (1995) – Java Development Kit
• JDK 1.0 (23rd Jan 1996)
• JDK 1.1 (19th Feb 1997)
• J2SE 1.2 (8th Dec 1998) – Java 2 Standard Edition
• 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 Platform Standard Edition
• Java SE 7 (28th July 2011)
• Java SE 8 (18th Mar 2014)
• Java SE 9 (21st Sep 2017)
• Java SE 10 (20th Mar 2018)
• Java SE 11 (September 2018)
• Java SE 12 (March 2019)
• Java SE 13 (September 2019)
• Java SE 14 (Mar 2020)
• Java SE 15 (September 2020)
• Java SE 16 (Mar 2021)
• Java SE 17 (September 2021)
• Java SE 18 (to be released by March 2022)
The Java Programming Language
Following are the notable features of Java:

Object Oriented
In Java, everything is an Object. Java can be easily extended since it is
based on the Object model.

Platform Independent
Unlike many other programming languages including C and C++, when Java
is compiled, it is not compiled into platform specific machine, rather into platform-
independent byte code. This byte code is distributed over the web and interpreted
by the Virtual Machine (JVM) on whichever platform it is being run on.
Simple
• Java is designed to be easy to learn. If
you understand the basic concept of
OOP Java, it would be easy to master.
Secure
The Java • With Java's secure feature it enables to
Programming develop virus-free, tamper-free
systems. Authentication techniques are
Language based on public-key encryption.
Architecture-neutral
• Java compiler generates an
architecture-neutral object file format,
which makes the compiled code
executable on many processors, with the
presence of Java runtime system.
Portable
Being architecture-neutral and having
no implementation dependent aspects of the
specification makes Java portable. The compiler
in Java is written in ANSI C with a clean
portability boundary, which is a POSIX subset.

The Java Robust

Programming Java makes an effort to eliminate


error-prone situations by emphasizing mainly on
Language compile time error checking and runtime
checking.

Multithreaded
With Java's multithreaded feature it is
possible to write programs that can perform
many tasks simultaneously. This design feature
allows the developers to construct interactive
applications that can run smoothly.
Interpreted
Java byte code is translated on the fly to
native machine instructions and is not stored
anywhere. The development process is more rapid and
analytical since the linking is an incremental and light-
weight process.

The Java High Performance


With the use of Just-In-Time compilers, Java
Programming enables high performance.

Language Distributed
Java is designed for the distributed
environment of the internet.

Dynamic
Java is considered to be more dynamic than
C or C++ since it is designed to adapt to an evolving
environment. Java programs can carry an extensive
amount of run-time information that can be used to
The Java Programming Language
With most programming
languages, you either compile or interpret
a program so that you can run it on your
computer. The Java programming
language is unusual in that a program is
both compiled and interpreted. With the
compiler, first you translate a program
into an intermediate language called Java
bytecodes —the platform-independent
codes interpreted by the interpreter on
the Java platform. The interpreter parses
and runs each Java bytecode instruction
on the computer. Compilation happens
just once; interpretation occurs each time
the program is executed. The following
figure illustrates how this works.
The Java Programming
Language

You can think of Java


bytecodes as the machine code
instructions for the Java Virtual Machine
(Java VM). Every Java interpreter,
whether it's a development tool or a Web
browser that can run applets, is an
implementation of the Java VM.
Java bytecodes help make
"write once, run anywhere" possible. You
can compile your program into bytecodes
on any platform that has a Java compiler.
The bytecodes can then be run on any
implementation of the Java VM. That
means that as long as a computer has a
Java VM, the same program written in
the Java programming language can run
on Windows 2000, a Solaris workstation,
or on an iMac.
The Java Platform
A platform is the hardware or software environment
in which a program runs. We've already mentioned some of the
most popular platforms like Windows 2000, Linux, Solaris, and
MacOS. Most platforms can be described as a combination of
the operating system and hardware. The Java platform differs
from most other platforms in that it's a software-only platform
that runs on top of other hardware-based platforms.

The Java platform has two components:


• The Java Virtual Machine (Java VM)
• The Java Application Programming Interface (Java API)

You've already been introduced to the Java VM. It's the base for
the Java platform and is ported onto various hardware-based
platforms.
The Java Platform
The Java API is a large collection of
ready-made software components that provide
many useful capabilities, such as graphical user
interface (GUI) widgets. The Java API is grouped
into libraries of related classes and interfaces;
these libraries are known as packages. Highlights
what functionality some of the packages in the Java
API provide.

The following figure depicts a program


that's running on the Java platform. As the figure
shows, the Java API and the virtual machine
insulate the program from the hardware.
The Java Platform

Native code is code that after you compile it, the compiled code runs
on a specific hardware platform. As a platform-independent environment, the Java
platform can be a bit slower than native code. However, smart compilers, well-tuned
interpreters, and just-in-time bytecode compilers can bring performance close to that of
native code without threatening portability.
We will learn how to write the simple program of
java.
Creating Hello World Example

Let’s Create the hello world Java Program:

First Java 1. class HelloWorld{


2. public static void main(String args[]){
Program 3. System.out.println("Hello World");
4. }
5. }

Output: Hello World


Let's see what is the meaning of class, public,
static, void, main, String[], System.out.println().

• class keyword is used to declare a class in


java.
Parameters • public keyword is an access modifier which
used in First represents visibility. It means it is visible to
all.
Java
Program • static is a keyword. If we declare any method
as static, it is known as the static method. The
core advantage of the static method is that
there is no need to create an object to invoke
the static method. The main method is
executed by the JVM, so it doesn't require to
create an object to invoke the main method.
So it saves memory.
• void is the return type of the method. It
means it doesn't return any value.

• main represents the starting point of the


Parameters program.

used in First • String[] args is used for command line


Java argument. We will learn it later.

Program • System.out.println() is used to print


statement. Here, System is a class, out is
the object of PrintStream class, println()
is the method of PrintStream class. We
will learn about the internal working of
System.out.println statement later.
Thank you!

You might also like