0% found this document useful (0 votes)
15 views5 pages

Unit 1

Uploaded by

Sabarigiri Vason
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Unit 1

Uploaded by

Sabarigiri Vason
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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.

1.Compiled and Interpreted:

Usually a computer language is either compiled or interpreted. Java combines both these thus making Java a
two stage system.First java compiler translates source code into bytecode instructions. Bytecodes are not
machine instructions and therefore, in the second stage, Java interpreter generates machine code that can be
directly executed by the machine that is running the java program.

2. 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 top of other hardware-based platforms. It has two components:

1. Runtime Environment
2. API(Application Programming Interface)

Java code can be executed 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).

3. Robust:
There are exception handling and the type checking mechanism in Java. All these points make Java
robust. In Java, any runtime error encountered by the JVM is never passed on to the underlying system rather as
soon as any such error occurs, the JVM immediately terminates the program stopping it from causing any harm to
the underlying system. Thus we can say that Java is a robust language which does not allow any such operation by
the program which can cause any kind of harm to OS.

4. Secured:
Java is best known for its security. With Java, we can develop virus-free systems.

o No explicit pointer-Thus in Java we cannot access any address directly and this makes Java much more reliable
and secure as compared to C/C++.
o Java Programs run inside a virtual machine sandbox
o Classloader: Classloader 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 rights to
objects.
o Security Manager: It determines what resources a class can access such as reading and writing to the
local disk.

5. Distributed:
In Java, we can split a program into multiple parts and store these partss on different computers. Now sitting on
one machine a Java programmer can access another Java program running of the other machine. This in Java
gives the advantage of distributed programming, which is very helpful when we develop large projects. Java helps
us to achieve this by providing concept of RMI.

6. Simple:
o Java is very easy to learn, and its syntax is simple, clean and easy to understand. 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.

7. 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 incorporate both data and
behavior. Java strongly supports the concept of OOPs due to which it is called a Pure object oriented language. Moreover,
Java strictly follows every principle of OOPs. For example we cannot develop an executable program in Java without
making use of class. This indicates that Java very strictly applies the principal of Encapsulation.

8. Multi-threaded:
Multithreading means executing multiple portions (functions) of the same program in parallel. Just like in Microsoft word,
multiple functionalities take place at same time, like typing, spell check, grammar check, auto save, auto complete, office
assistant etc… Since all this is taking place inside MS Word, we can say that it is an example of multithreading. Java is one
of the pioneer language to support this concept. Thus development of multithreaded application is one of the important
strength of Java.

9. Automatic memory management:


In Java, just like C or C++ programmer can request dynamic memory block at runtime using the keyword new. But
the deallocation of these memory blocks is automatically handled by JVM i.e. a Java programmer does not have
to worry about deallocation of dynamic memory. So, runtime errors like memory leaks which were very common
in C/C++ do not happen at all in Java.

10. Dynamic:
Java is a dynamic language. It supports the 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).

GARBAGE COLLECTION :

Objects are dynamically allocated by using the new operator, dynamically allocated objects must be
manually released by use of a delete operator. Java takes a different approach; it handles
deallocation automatically this is called garbage collection. When no references to an object exist,
that object is assumed to be no longer needed, and the memory occupied by the object can be
reclaimed. Garbage collection only occurs sporadically (if at all) during the execution of your
program. It will not occur simply because one or more objects exist that are no longer used.
THE JAVA ENVIRONMENT:

JVM (Java Virtual Machine) JVM (Java Virtual Machine) is an abstract machine. It is a specification
that provides runtime environment in which java bytecode can be executed. JVMs are available for
many hardware and software platforms (i.e. JVM is platform dependent). The JVM performs
following operation:

Loads code Verifies code Executes code Provides runtime environment JVM provides
definitions for the: Memory area Class file format Register set Garbage-collected heap Fatal
error reporting etc.

JVM Architecture
Let's understand the internal architecture of JVM. It contains classloader, memory area, execution engine etc.
JRE

JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. The Java Runtime Environment
is a set of software tools which are used for developing Java applications. It is used to provide the runtime
environment. It is the implementation of JVM. It physically exists. It contains a set of libraries + other files that
JVM uses at runtime.

The implementation of JVM is also actively released by other companies besides Sun Micro Systems.

JAVA DEVELOPMENT KIT (JDK):

The Java Development Kit (JDK) is a software development environment usedfor developing Java applications and
applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar),
a documentation generator (javadoc) and other tools needed in Java development.

javac- Java compiler

java- Java interpreter

javap-Java disassemble

javah- for c-header files

jdb-java debugger

JIT (JUST IN TIME) COMPILER:

It is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time,
and hence reduces the amount of time neededfor compilation.

You might also like