Hey guys!!! Welcome to flower brackets blog. Also known as java buzzwords, today let’s learn java features.
Java is concise, easy to write and more readable. Java was designed with a small number of language constructs so that programmers could learn it quickly. It eliminates several language features available in C and C++ that are associated with poor programming practice. Rarely used example of them are go-to statements, header files structures, operator overloading, multiple inheritance and pointers.
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. Java Runtime Environment(JRE) uses a bytecode verification process to ensure that code loaded over the network does not violate java security constraints.
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.
- High Performance
Java byte codes are highly optimized. The use of byte code makes the performance high. It was designed to support just-in-time compilers which dynamically compiled by byte codes to machine codes.
- Object Oriented
Java is pure object oriented programming(OOP) language. It provides most of the object oriented features. All programs and data reside inside our objects and classes. These objects have unique identity that encapsulate attributes and operations and are instances of classes related by inheritance and polymorphism.
Java encourages error free programming by being strictly typed and performing run-time checks. Java is designed to eliminate certain types of programming errors. Java is strongly typed which allows extensive compile time error 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.
Multi-threading means handling more than one job at a time. Java supports multithreading, that is, supporting multiple threads of execution including a set of synchronization primitives. Java provides integrated support for multi-threaded programming. This makes programming with threads much easier.
- Dynamic language
Java supports dynamic loading of classes so it is capable of linking dynamic new class, methods and objects also known as load on demand, 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.
Java features : platform independent
Platform independent is the best feature of java. Now in this section we are going to discuss how java is a platform independent.
Platform independent means writing codes in one operating system, for example, windows XP and executing that code on another platform, for example, Mac or Linux.
Java is WORA. That means Write Once and Run Anywhere. This phenomenon is called platform independent. Another factor that makes java platform independent language is byte code. Byte code is a machine language of the Java Virtual Machine(JVM).
Java bytecode execution
Now in this section we will discuss java byte code execution,
Above image explains the execution flow of the java program. First, to execute a java program source code is written in a plain text file and saved with java extension using java compiler.
The source code is compiled into dot class(.class). The dot class file contains the source code in the form of byte code.
Byte code is a machine language of java virtual machine or JVM. Java interpreter and JIT compiler is present inside JVM.
Also read – learn java overview
JVM converts the byte code dot class file into executable code object with the help of the interpreter or jit compiler as needed.
This executable code object file is used to generate the output. Different types of JVM are available on different operating systems such as the,
- Sun JVM
- Microsoft JVM
- IBM JVM etc..
Using the JVM dot class (.class) file can run on various platforms. This is the way byte code executes java programs and proves that java is a platform independent language.
Just In Time(JIT) compiler is a compiler that converts program source code into native machine code just before running the program.
The JIT compiler compiles faster and more efficient to perform huge applications.