Java Buzz Words (OR) Features of Java
The features of Java are also known as Java buzzwords.A list
of the most important features of the Java language is
given below.
•Simple
•Platform Independent
•Architectural Neutral
•Dynamic and Extensible
•Portable
•Multi Threading
•Distributed
•Networked
•Robust
•Secured
•High Performance
•Object Oriented
Simple
Java is very easy to learn, and its syntax is simple, clean and
easy to understand. According to Sun Microsystems, Java
language is a simple programming language because:
•Java syntax is based on C++ (so easier for programmers to
learn it after C++).
•Java has removed many complicated and rarely-used
features, for example, explicit pointers, operator overloading,
etc.
•There is no need to remove unreferenced objects because
there is an Automatic Garbage Collection in Java.
Object-oriented
Java is an object-orientedprogramming 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 behaviour.
Object-oriented programming (OOPs) is a methodology that
simplifies software development and maintenance by
providing some rules.Basic concepts of OOPs are:
•Object
•Class
•Inheritance
•Polymorphism
•Abstraction
•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. 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:
•Runtime Environment
•API(Application Programming Interface)
Java code can be executed on multiple platforms, for
example, Windows, Linux,Mac/OS, etc. Java code is
compiled by the compiler and converted into byte code.
This byte code is a platform-independent code because it
can be run on multiple platforms, i.e., Write Once and
Run Anywhere (WORA).
Portable
Java is portable because it facilitates you to carry the Java
byte code to any platform. It doesn't require any
implementation.
Secure
No explicit pointer. Java Programs run inside a virtual
machine sandbox.
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.
Byte code Verifier: It checks the code fragments for illegal
code that can violate access rights to objects.
Security Manager: It determines what resources a class
can access such as reading and writing to the local disk.
Robust
The English meaning of Robust is strong. Java is robust
because:
•It uses strong memory management.
•There is a lack of pointers that avoids security problems.
•Java provides automatic garbage collection which runs on the
Java Virtual Machine to get rid of objects which are not being
used by a Java application anymore.
There are exception handling and the type checking
mechanism in Java. All these points make Java robust
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++.
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.
Portable
Java is portable because it facilitates you to carry the Java
byte code to any platform. It doesn't require any
implementation.
High-performance
Java is faster than other traditional interpreted programming
languages because Java byte code is "close" to native code. It
is still a little bit slower than a compiled language (e.g., C++).
Java is an interpreted language that is why it is slower than
compiled languages, e.g., C, C++, etc.
Distributed
Java is distributed because it facilitates users to create
distributed applications in Java. RMI and EJB 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.
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. The main advantage of multi-
Definition of Garbage Collection
•In java, garbage means unreferenced objects.
•Garbage Collection is process of reclaiming the runtime
unused memory automatically. In other words, it is a way to
destroy the unused objects.
•To do so, we were using free() function in C language and
delete() in C++. But, in java it is performed automatically. So,
java provides better memory management.
Advantage of Garbage Collection:
•It makes java memory efficient because garbage collector
removes the unreferenced objects from heap memory.
•It is automatically done by the garbage collector(a part of
JVM) so we don't need to make extra efforts.
Object-Oriented Programming
•OOP stands for Object-Oriented Programming.
•Procedural programming is about writing procedures or
functions that perform operations on the data, while object-
oriented programming is about creating objects that contain
both data and functions.
•Object-oriented programming has several advantages over
procedural programming:
•OOP is faster and easier to execute.
•OOP provides a clear structure for the programs.
•OOP makes the code easier to maintain, modify and debug.
•OOP makes it possible to create full reusable applications
with less code and shorter development time.
•The main aim of object-oriented programming is to
implement real-world entities, for example, object, classes,
OOPs (Object-Oriented Programming System):
Object means a real-world entity such as a pen, chair, table,
computer, watch, etc. Object-Oriented Programming is a
methodology or paradigm to design a program using classes
and objects. It simplifies software development and
maintenance by providing some concepts:
Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
Object
Any entity that has state and behaviour is known as an object.
For example, a chair, pen, table, keyboard, bike, etc. It can be
physical or logical.
An Object can be defined as an instance of a class. An object
contains an address and takes up some space in memory.
Objects can communicate without knowing the details of
each other's data or code. The only necessary thing is the
type of message accepted and the type of response returned
by the objects.
Example: A dog is an object because it has states like color,
name, breed, etc. as well as behaviours like wagging the tail,
barking, eating, etc.
Class
Collection of objects is called class. It is a logical entity.
A class can also be defined as a blueprint from which you can
create an individual object. Class doesn't consume any space.
Inheritance
When one object acquires all the properties and behaviours
of a parent object, it is known as inheritance. It provides code
reusability. It is used to achieve runtime polymorphism.
Polymorphism
If one task is performed in different ways, it is known as
polymorphism. For example: to convince the customer
differently, to draw something, for example, shape, triangle,
rectangle, etc.
In Java, we use method overloading and method overriding to
achieve polymorphism.
Another example can be to speak something; for example, a
cat speaks meow, dog barks woof, etc.
Abstraction
Hiding internal details and showing functionality is known as
abstraction. For example phone call, we don't know the
internal processing.
In Java, we use abstract class and interface to achieve
abstraction.
Encapsulation
Binding (or wrapping) code and data together into a single
unit are known as encapsulation. For example, a capsule, it is
wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the
fully encapsulated class because all the data members are
private here.