Let’s learn major features of java.
Major features of java
Here are some important features of java. It’s also known as java buzzwords. Java is,
Java is concise, easy to write, understand and learn. Java is designed based on C++ so that programmers could learn it easily. It eliminates several language features available in C and C++.
For example – java has removed go-to statements, header files structures, operator overloading and pointers.
There is no explicit pointer in java. It provides secure way to access web applications and secure means of creating Internet application.
Java is designed to be secure in a networked environment. Classloader a part of JRE loads classes into JVM dynamically.
Classloader separates package for classes of local file from imported network sources, thereby adding security.
It uses bytecode verification to ensure that code loaded over the network does not violate java security constraints.
Why is java Portable
Java programs can execute in any environment and can be run on any platform like Linux, Mac and Windows. The byte code generated by java can be used on any machine.
Java byte codes are highly optimized. The use of byte code makes the performance high. Java uses just-in-time compilers.
Object Oriented features of java
Java is pure object oriented programming(OOP) language. Everything in java is an object. Java can be extended on Object model.
Here objects are organized into classes. These objects have unique identity that encapsulate attributes and operations and are instances of classes related by inheritance and polymorphism.
Basic concept of object oriented programming or object-oriented features of java are object, class, encapsulation, abstraction, inheritance and polymorphism.
Why java is robust
Java is robust because java encourages error free programming by being strictly typed and performing compile time and run time error checks.
Java is designed to eliminate certain types of programming errors. Meanwhile in java there are exception handling and strong type checking.
It does not support memory pointers which eliminates the possibility of overwriting memory and corrupting data.
In addition it’s automatic memory management called garbage collection which runs on JVM.
Multi-threading means handling more than one job at a time. It shares common memory area. Java supports multiple program execution including a set of synchronization primitives.
Java provides integrated support for multi-threaded programming. This makes programming with threads much easier. Hence improves CPU utilization.
Java supports dynamic loading of classes. It is capable of linking dynamic class, methods and objects also known as load on demand. It also supports dynamic compilation and automatic memory management.
During the execution of a program, java can dynamically load class libraries that it requires. In addition java is designed to support various levels of network connectivity.
Platform independent is the best feature of java. Here platform is nothing but software environment in which a program runs.
Platform independent means writing code in one operating system, for example, windows and executing that code on another platform, for example, Mac or Linux.
Java is WORA. Meaning “Write Once Run Anywhere”. Another factor that makes java platform independent language is bytecode.
In java code is compiled by compiler and converted into bytecode. This bytecode is platform independent.
It is an important feature in java. If you consider C language size of datatype depend on architecture of compiler.
For example for integer variable it occupies 2 bytes of memory for a 16 bit compiler.
For 32 bit compiler it occupies 4 bytes of memory. That means memory allocation depends on architecture.
Whereas in java irrespective of architecture, memory allocated to variables will not vary. It generates architecture neutral object file format.
In java we can create distributed applications. Distributed applications facilitates users to create softwares which run on multiple systems which are connected to a network at the same time. Also known as distributed environment.
To create these distributed applications EJB (Enterprise Java Beans) and RMI (Remote Method Invocation) concept is used.
In java bytecode is translated to native machine and this bytecode is not stored anywhere. Hence development is fast and lightweight.
This is all about major features of java. In this post I have covered features of java, why java is portable, object-oriented features of java and many more.
I hope this post would be helpful for freshers interview questions on core java.