Introduction To Java
Introduction To Java
History of Java
James Gosling initiated Java language project in June 1991 for use in one of his many set-top box
projects. The language, initially called ‘Oak’ after an oak tree that stood outside Gosling's office,
also went by the name ‘Green’ and ended up later being renamed as Java, from a list of random
words.
Sun released the first public implementation as Java 1.0 in 1995. It promised to Write Once, Run
Anywhere (WORA), providing no-cost run-times on popular platforms.
On 13 November 2006, Sun released much of Java as free and open source software under the
terms of the GNU General Public License (GPL).
On 8 May 2007, Sun finished the process, making all of Java's core code free and open-source,
aside from a small portion of code to which Sun did not hold the copyright.
Java was started as a project called "Oak" by James Gosling in June 1991. Gosling's goals were
to implement a virtual machine and a language that had a familiar C-like notation but with
greater uniformity and simplicity than C/C++. The first public implementation was Java 1.0 in
1995. It made the promise of "Write Once, Run Anywhere", with free runtimes on popular
platforms. It was fairly secure and its security was configurable, allowing for network and file
access to be limited. The major web browsers soon incorporated it into their standard
configurations in a secure "applet" configuration. popular quickly. New versions for large and
small platforms (J2EE and J2ME) soon were designed with the advent of "Java 2". Sun has not
announced any plans for a "Java 3".
In 1997, Sun approached the ISO/IEC JTC1 standards body and later the Ecma International to
formalize Java, but it soon withdrew from the process. Java remains a proprietary de facto
standard that is controlled through the Java Community Process. Sun makes most of its Java
implementations available without charge, with revenue being generated by specialized
products such as the Java Enterprise System. Sun distinguishes between its Software
Development Kit (SDK) and Runtime Environment (JRE) which is a subset of the SDK, the
primary distinction being that in the JRE the compiler is not present.
Java – feature:
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
TLP
Java Chapter -2: Introduction to Java
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
With Java's secure feature it enables to develop virus-free, tamper-free systems.
Authentication techniques are 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.
Robust
Java makes an effort to eliminate error-prone situations by emphasizing mainly on
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.
High Performance
With the use of Just-In-Time compilers, Java enables high performance.
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 verify and resolve accesses to objects at run-time.
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
accessible to a
broader audience.
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
third-party libraries
for thread support.
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
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.
TLP
Java Chapter -2: Introduction to Java
Inheritance Along with the other features of On other hand C does not
and OOPs Java also contains the supports Inheritance which is very
Threading property of Inheritance which is useful for code re usability.Thus C
very useful in code reuse is not preferred when one has to
5
ability.Also Java supports relate the things according to the
concept of Threading. real world as per inheritance
relation.Also C does not supports
Threading.
TLP
Java Chapter -2: Introduction to Java
Java environment:
A Java™ runtime environment (JRE) is a set of components to create and run a Java
application. A JRE is part of a Java development kit (JDK).
TLP
Java Chapter -2: Introduction to Java
A JRE is made up of a Java virtual machine (JVM), Java class libraries, and the Java class
loader. JDKs are used to develop Java software; JREs provide programming tools and
deployment technologies; and JVMs execute Java programs.
The Java class libraries contain collections of prewritten code that can be called when needed.
The class loader connects class libraries with the JVM and loads them into the JVM while the
program is running. The JVM then executes the code.
Java SE is freely available from the link Download Java. You can download a version based
on your operating system.
Follow the instructions to download Java and run the .exe to install Java on your machine. Once
you installed Java on your machine, you will need to set environment variables to point to correct
installation directories −
o Now, alter the 'Path' variable so that it also contains the path to the Java executable.
Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your
path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.
TLP
Java Chapter -2: Introduction to Java
• Notepad − On Windows machine, you can use any simple text editor like Notepad
(Recommended for this tutorial), TextPad.
• Netbeans − A Java IDE that is open-source and free which can be downloaded
from https://www.netbeans.org/index.html.
• Eclipse − A Java IDE developed by the eclipse open-source community and can be
downloaded from https://www.eclipse.org/
The Java Virtual Machine is a program whose purpose is to execute other programs. It's a
simple idea that also stands as one of our greatest examples of coding kung fu. The JVM upset
the status quo for its time, and continues to support programming innovation today.
The JVM has two primary functions: to allow Java programs to run on any device or operating
system (known as the "Write once, run anywhere" principle), and to manage and optimize
program memory. When Java was released in 1995, all computer programs were written to a
specific operating system, and program memory was managed by the software developer. So
the JVM was a revelation.
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
The Java Virtual Machine is a program whose purpose is to execute other programs. It's a
simple idea that also stands as one of our greatest examples of coding kung fu. The JVM
upset the status quo for its time, and continues to support programming innovation today.
The JVM has two primary functions: to allow Java programs to run on any device or
operating system (known as the "Write once, run anywhere" principle), and to manage and
optimize program memory. When Java was released in 1995, all computer programs were
written to a specific operating system, and program memory was managed by the software
developer. So the JVM was a revelation.
TLP
Java Chapter -2: Introduction to Java
JavaWorld / IDG
Having a technical definition for the JVM is useful, and there's also an everyday way that
software developers think about it. Let's break those down:
• Technical definition: The JVM is the specification for a software program that executes
code and provides the runtime environment for that code.
• Everyday definition: The JVM is how we run our Java programs. We configure the
JVM's settings and then rely on it to manage program resources during execution.
When developers talk about the JVM, we usually mean the process running on a machine,
especially a server, that represents and controls resource usage for a Java app. Contrast
this to the JVM specification, which describes the requirements for building a program that
performs these tasks.
TLP
Java Chapter -2: Introduction to Java
What is JDK?
JDK is a software development environment used for making applets and Java applications. The
full form of JDK is Java Development Kit. Java developers can use it on Windows, macOS,
Solaris, and Linux. JDK helps them to code and run Java programs. It is possible to install more
than one JDK version on the same computer.
What is JRE?
JRE is a piece of a software which is designed to run other software. It contains the class
libraries, loader class, and JVM. In simple terms, if you want to run Java program you need JRE.
If you are not a programmer, you don't need to install JDK, but just JRE to run Java programs.
Though, all JDK versions comes bundled with Java Runtime Environment, so you do not need to
download and install the JRE separately in your PC. The full form of JRE is Java Runtime
Environment.
What is JVM?
JVM is an engine that provides a runtime environment to drive the Java Code or applications. It
converts Java bytecode into machine language. JVM is a part of Java Run Environment (JRE). It
cannot be separately downloaded and installed. To install JVM, you need to install JRE. The full
form of JVM is Java Virtual Machine.
In many other programming languages, the compiler produces machine code for a specific
system. However, Java compiler produces code for a virtual machine which is called as JVM.
TLP
Java Chapter -2: Introduction to Java
TLP
Java Chapter -2: Introduction to Java
run by the
JRE and JVM.
BLOG
Main
Blog
Mobile Development
TLP
Java Chapter -2: Introduction to Java
Contents
o Introduction
o Benefits of Java
o Drawbacks of Java
TLP
Java Chapter -2: Introduction to Java
If you finally made up your mind to go for software development, you definitely have to weigh all
the pros and cons of IT outsourcing and offshoring. And the prior step these thoughts is another
vital step – choosing the right technology stack for the project. So if you are still in two minds
whether Java outsourcing is something you need or maybe it’s better to opt for some other
technology, it might be because you lack some details to get the full picture. We gathered the
pros and cons of Java here to help you.
Introduction
If somebody asks you to name 5 technologies that you know, Java will probably be among
them. And actually, if we take the Stack Overflow’s Developer survey conducted in 2019, more
than 53% of developers named Java as their most loved language.
One of the grounds for such admiration is not surprising since Java itself is much more than just
a technology. That’s an entire complex of tools which embraces nearly everything one needs for
Java development. So it consists of the elements listed below:
1. Java Development Kit (JDK) – that’s the first thing a developer downloads to start any
development on Java. JDK itself is a software package which comprises the compiler,
documentation, utilities and Java Runtime Environment (JRE).
2. Java Runtime Environment – a software layer running on top of a computer's operating
system. It basically includes Java Virtual Machine (JVM) and the standard Java Class Library.
JRE merges the code with the required libraries, then launches the JVM (a tool converting Java
bytecode into machine code) for the execution of the code. Plus it ensures the dependencies to
be available to the Java programs you develop.
3. Integrated Development Environment (IDE) – the app which allows its user to run, edit and
compile the code. A number of IDEs have features like syntax highlighting and code completion,
which eases the process of coding. If we take the top 3 IDEs which Java developers adore, they
will be IntelliJ IDEA, Eclipse, and NetBeans.
Frankly speaking, Java is almost everywhere around. If your smartphone has the Android
platform then its full of Java, as that’s the main technology used for Android development. Still
not too convincing? Then here are some more examples: Big Data, web apps and state
websites, scientific computing – all of them mostly have Java “inside”. And initially, mobile
games also were written in Java (we’re talking about the period of the 2000s before the
smartphones were invented).
As we are through with the introduction part, we shall continue with the gist of our
“investigation”: the advantages and disadvantages of Java.
Benefits of Java
Until 2016 (the year when Kotlin had its first official stable release) Java was irreplaceable in
Android development and this happened for a very simple reason: Java was the only official
programming language for Android development. Though nowadays it has a competitor named
Kotlin, still today there’s a great variety of options for web development using Java. Despite the
high competition with other technologies, Java doesn’t fall behind and still has a number of pros
to offer which can persuade one to make the choice in its favour.
1. It’s a high-level language. This notion implies a programming language to be much like
human language rather than a machine one. Consequently, it should be easy and simple to
TLP
Java Chapter -2: Introduction to Java
Drawbacks of Java
Unfortunately, like any technology, Java has not only advantages but also a bunch of
disadvantages. The several significant cons of Java are:
1. Java’s performance. If we compare Java programs to those written in С or C++ which are
natively compiled, it’s easily noticed that they are much slower.
2. Its memory. In Java, the memory is managed through garbage collection, so anytime the
garbage collector works, it deteriorates the way the app performs. The main reason for that is
that the garbage collector works only when all other threads are not working.
3. Costs for the commercial license. Since 2019 Oracle expects the users to pay for Java
Standard Edition 8 when used for purposes such as business, commerce and production. So
when you need updates and bug fixing, you’ll be charged by the number of users you have or
for the processor. It hurts a lot when you start counting the new costs.
4. The look is not native (desktop). Programmers utilize a variety of tools special for each
language in order to build the graphical user interface, GUI for short. Of course, we shouldn’t
forget about Android Studio, which was initially designed for Android mobile development so the
apps both feel and look native. Therefore, as soon as the conversation goes to the user
interface of desktop programs, Java is certainly lagging behind and you’ll have to conduct really
thorough research to find a tool that will be just fine to create your graphical user interface.
5. Java’s verbosity makes the code rather complicated. Java implies that one needs to use
many words used as it’s quite similar to the natural language of humans a lot. The developers
almost literally write down their commands and thoughts so the code is drastically huge
(especially when compared to Python).
TLP
Java Chapter -2: Introduction to Java
TLP