Java is a general purpose object oriented programming language.
Java is popular mainly due to two reasons, 1) It is platform independent. 2) It eliminates a lot of security issues.
Top 8 features of java are listed below,
- Simple design
- Platform independent and portable
- High performance
- Robust and secure
- Multi-threading and interactive
Features of Java
1. Simple and familiar
When java was developed they wanted to be simple because it has to be work on electronic device where less memory is available. Pointer concepts and goto statement are very complex in C++ but in java they have eliminated pointer concept, goto statement and many others. Since java maintained same syntax of C and C++, programmer who knows C and C++ will find java already familiar.
Click here to know more Java vs C++.
Since java is structured language, it is easy to learn and and syntax is bit easy to understand. Java is easy to write, eye catching and more readable.
In java almost everything is in object so java is pure object oriented language. Java program uses object and class concepts. Here code and data reside within object and classes. Object concept is simple and easy to extend. Due to Object oriented nature java can be stretched easily.
Top 4 OOPs concepts in java are,
3. Platform independent and portable
Java compiler converts Source code (.java) (which are in human readable form)into Byte code (.class). Java byte code (.class file) can be run on any machine with any processor and any OS (platform). So java is called platform independent. The Byte code generated by java can be used on any machine.
JVM (Java virtual machine) reads these byte code during program execution and converts byte code into machine readable form. Here JVM is platform dependent. Since same byte code can run on every machine which yields same result is called portable.
4. High performance
JVM uses both interpreter and JIT compiler together to execute the program so speed of the execution will be faster. Byte codes are highly optimized.
Especially java is designed for internet users, protocols like TCP/IP and UDP can handle by Java. It has an ability to share both data and programs on various computers on a network. A service which runs in multiple servers and that service is accessed by number of clients across the globe. With J2EE we can develop distributed application with trusted network architecture.
6. Robust and secure
Java program are very strong and it won’t crash easily mainly due to these three reasons.
- It has strong inbuilt exception handling features.
- Its excellent memory management features.
- Effective use of garbage collection.
Java will take first choice when it comes to security. Java is a secure language because it eliminates tampering, impersonation and virus which are often on internet. Java does not interact with system OS. It always runs in Java runtime environment.Thus it does not harm system OS.
Natives methods of java are linked dynamically at run time. In java everything is not finalized till execution because many things happen at runtime. Run time polymorphism will be the best example.
Handling multiple tasks simultaneously by different threads is called Multithreading. A thread represents an individual process to execute a group of statements. By effective use of same memory and resources, multiple threads will be executed at the same time. It doesn’t occupy memory for each thread. It shares a common memory area with all threads.
Top 5 interview questions:
- What is java? Why it is so popular?
- What are the feature of java?
- How java is secure language?
- How JIT enhance the speed of java execution?
- What is the benefit of Multi-threading?