Thursday, July 17, 2014

Why Java Is Preferred?

The developers preferred java over traditional programming languages like C and C++.Java is preferred due to its unique feature platform independent, robustness and more secure.
·         Simple: Java inherits most of the syntax of C and many of the OOPs features of C++. In addition to this is has its own add in features which are easy for professional programmers to learn.
·         Object Oriented: Java uses OOPs concepts for faster programming. It has most of the packages and interfaces built-in which are easily reused and extended. The class and object structure provides data encapsulation, abstraction, inheritance and polymorphism.
·         Robust:  Java is robust because of two reasons memory management and exception handling. In traditional programming C,C++ dynamic memory management is very difficult as memory allocation and de-allocation must be done by programmer but java does this dynamic memory allocation and de-allocation without any extra efforts. Exceptional conditions may arise in traditional programming which may leads to abnormal termination of programs but java provides exception handling which helps to handle and eliminate these run time errors.
·         Secure: All java programs run over JVM platform and not on Operating system. So any OS related updates or modification does not affect execution of java program. Java also provides packages and access modifiers which in turn provides security. Java applets are executed inside sandbox which creates an environment which provides restricted access to OS resources and allows user to run untrusted code from unknown source safely. Java uses byte code verifier module which checks java code automatically before executing it. Java provides run time array boundary check which is not provided in traditional programming. In traditional programming memory references can be manipulated but in java you cannot manipulate references which interns provides secure memory access.
·         Platform Independent: Traditional languages C, C++ were designed to compile for specific platform (processors, OS). In java executable code runs over JVM platform which is independent of OS. So once we have byte code (.class file) we can execute it on any OS. So java code needs to be compile only once and we can execute it any number of times across different platforms (processors, OS). So it is “write once, run anywhere, anytime”. 
·      Multithreaded: Java provides multithreaded programming which allows doing many things simultaneously. Each thread performs separate task. For example using text editor with spell check feature enabled which allows editing and spelling check simultaneously.

No comments:

Post a Comment