Java has significant advantages over other programming languages like C/C++. Below are the advantages of using Java :--
1. Simple to learn and practice
Learning and practicing Java is easy because of it's resemblance with C and C++ basic programming languages.
2. Purely OOP (Object Oriented Programming)
Java is purely Object Oriented Programing language. In Java, both data and functions are bundled together in a class. C++ is also considered as Object oriented language but C++ also supports procedural programming language like C. You are not required to use classes in C++ to program something.
3. Java is platform independent, hence portable
One of the most significant advantages of Java is
its ability to move easily from one computer system to another. Java code can be compiled on one platform like windows etc and can be executed on other platform like Linux etc.
Before going in to details, first lets understands what is meaning of platform. Platform consists of computer hardware (architecture of the microprocessor) plus Operating System. Thus platform is :--
Platform = Computer hardware + Operating System.
Anything that is platform independent can run on any operating system and hardware.
When java code is compiled, byte code is generated which is machine independent and can run on any machine with any processor and with any OS. Below diagram shows java compilation process:--
Java Compilation Process
This byte code is interpreted by JVM (Java Virtual Machine). So , JVM reads the byte code and executes it. Different JVM are designed for different OS and thus byte code is able to execute on different machine. C/C++ compilers generates the machine native code which is machine dependent and not the byte code.
Thus, it the JVM that is installed in any machine makes Java Platform Independent. JVM is part of JRE (Java Runtime Environment) and not part of OS.
This byte code is interpreted by JVM (Java Virtual Machine). So , JVM reads the byte code and executes it. Different JVM are designed for different OS and thus byte code is able to execute on different machine. C/C++ compilers generates the machine native code which is machine dependent and not the byte code.
Thus, it the JVM that is installed in any machine makes Java Platform Independent. JVM is part of JRE (Java Runtime Environment) and not part of OS.
What If JVM is not installed in ?
To run any any java code, JRE libraries are needed and JRE libraries provides the JVM implementation.
JDK provides tools to develop java programs like java compiler (javac) and debugging tools where as JRE provides tools for running Java code.
4. Robust
In computer science, robustness
is the ability of a computer system to cope with errors during
execution or the ability of an algorithm to continue to operate despite
abnormalities in input, calculations, etc.
Java puts lots of emphasis on early checking of possible errors at compile time. Java compilers are able to detect many errors at compile time.
Java programs are crash resistant because of its exception handling and its memory management features such as garbage collection and possibility of identifying many possible errors at compile time.
5. Distributed
Java is designed for use on network; it has an extensive library which works in agreement with TCP/IP.
6. Secure
Java is designed for use on Internet. Java enables the construction of virus-free, tamper free systems.
7.Multithreaded
Executing different parts of program simultaneously is called multithreading. This is an essential feature to design server side programs.
No comments:
Post a Comment