Core Java
2) Features of Java
Features of Java
Features of a language are nothing but the set of services or facilities provided by the language vendors to the industry programmers. Some important features of java are;
    Platform Independent
    Architectural Neutral
    High Performance
    Object Oriented
1. Simple
It is simple because of the following factors:
    It is free from pointer due to this execution time of application is improve.
    It has Rich set of API (application protocol interface).
    It has Garbage Collector which is always used to collect un-Referenced (unused) Memory location for improving performance of a Java program.
    It contains user friendly syntax for developing any applications.
Define an API
An application program interface (API) is a set of routines, protocols, and tools for building software applications. A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.
Define Garbage Collector
Garbage Collector is the system Java program which runs in the background along with regular Java program to collect un-Referenced (unused) memory space for improving the performance of our applications.
Note: java programming does not support destructor concept in place of destructor, we have garbage collector program.
Normal Flow of a Java Program
Java is a high level programming language. A program written in high level language cannot be run on any machine directly. First, it needs to be translated into that particular machine language. The javac compiler does this thing, it takes java program (.java file containing source code) and translates it into machine code (referred as byte code or .class file).
Java Virtual Machine (JVM) is a virtual machine that resides in the real machine (your computer) and the machine language for JVM is byte code. This makes it easier for compiler as it has to generate byte code for JVM rather than different machine code for each type of machine. JVM executes the byte code generated by compiler and produce output. JVM is the one that makes java platform independent.
So, now we understood that the primary function of JVM is to execute the byte code produced by compiler. Each operating system has different JVM; however the output they produce after execution of byte code is same across all operating systems. This means that the byte code generated on Windows can be run on Mac OS and vice versa. That is why we call java as platform independent language. The same thing can be seen in the diagram below:
Key Points:
    The Java Virtual machine (JVM) is the virtual machine that runs on actual machine (your computer) and executes Java byte code.
    The JVM doesn’t understand Java source code, that’s why we need to have javac compiler that compiles *.java files to obtain *.class files that contain the byte codes understood by the JVM.
    JVM makes java portable (write once, run anywhere). Each operating system has different JVM; however the output they produce after execution of byte code is same across all operating systems.
Note: Java is platform Independent but JVM is platform dependent because every Operating system has different-different JVM which is install along with JDK Software.
JRE: JRE is the environment within which the java virtual machine runs. JRE contains Java virtual Machine (JVM), class libraries, and other files excluding development tools such as compiler and debugger. Which means you can run the code in JRE but you can’t develop and compile the code in JRE.
JDK: JDK is a superset of JRE, it contains everything that JRE has along with development tools such as compiler, debugger etc. It physically exists. It is collection of programming tools and JRE, JVM.
Definition of JIT
JIT is the set of programs developed by SUN Micro System and added as a part of JVM, to speed up the interpretation phase.
2. Platform Independent
A program or technology is said to be platform independent if and only if which can run on all available operating systems with respect to its development and compilation. (Platform represents O.S).
3. Architectural Neutral
Architecture represents processor.
A Language or Technology is said to be Architectural neutral which can run on any available processors in the real world without considering their architecture and vendor (providers) irrespective to its development and compilation.
The languages like C, CPP are treated as architectural dependent.
4. Portable
If any language supports platform independent and architectural neutral feature known as portable. The languages like C, CPP, Pascal are treated as non-portable language. It is a portable language.
According to SUN microsystem.
    Platform Independent + Architecture Neutral = Portability
5. Multithreaded
A flow of control is known as thread. When any Language execute multiple thread at a time that language is known as multithreaded Language. It is multithreaded Language because of below reason.
When we execute any java program, the logic of the java program is executed by one of the thread known as foreground thread. To monitor the execution status of foreground thread one more thread is created known as background thread.so java program is containing 2 threads. Hence every java program is multi-threaded.
6. Distributed
Using this language, we can create distributed application. RMI and EJB are used for creating distributed applications. In distributed application multiple client system are depends on multiple server systems so that even problem occurred in one server will never be reflected on any client system.
7. Robust
Simply means of Robust is strong. It is robust or strong Programming Language because of its capability to handle Run-time Error, automatic garbage collection, lack of pointer concept, Exception Handling. All these points make It Robust Language.
8. Dynamic
It supports Dynamic memory allocation due to this memory wastage is reduce and improve performance of application. The process of allocating the memory space to the input of the program at a run-time is known as dynamic memory allocation, to programming to allocate memory space by dynamically we use an operator called 'new' 'new' operator is known as dynamic memory allocation operator.
9. Secure
In Java programming we have a dedicated APIs (Libraries) for dealing with security. Whereas non-Java programming language (C,C++) there is no existing libraries for security.
10. High performance
It has high performance because of following reasons;
    This language uses Bytecode which is faster than ordinary pointer code so Performance of this language is high.
    Garbage collector, collect the unused memory space and improve the performance of application.
    It has no pointers so that using this language we can develop an application very easily.
11. Interpreted
It is one of the highly interpreted programming languages.
Java bytecode is translated on the fly to native machine instructions which makes development process more rapid.
12. Object Oriented
Java is a purely object oriented programming language as its follow all the 5 features of Object oriented programming System. These features are
    Class and Object
Object Oriented Programming
Procedure Oriented Programming
In OOP, program is divided into parts called objects.
In POP, program is divided into small parts called functions.
In OOP, Importance is given to the data rather than procedures or functions because it works as a real world.
In POP, Importance is not given to data but to functions as well as sequence of actions to be done.
OOP follows Bottom Up approach.
POP follows Top Down approach.
OOP has access modifier named Public, Private, Protected, etc.
POP does not have any access modifier.
In OOP, objects can move and communicate with each other through member functions.
In POP, Data can move freely from function to function in the system.
OOP provides an easy way to add new data and function.
To add new data and function in POP is not so easy.
In OOP, data cannot move easily from function to function, it can be kept public or private so we can control the access of data.
In POP, Most function uses Global data for sharing that can be accessed freely from function to function in the system.
OOP provides Data Hiding so provides more security.
POP does not have any proper way for hiding data so it is less secure.
In OOP, overloading is possible in the form of Function Overloading and Operator Overloading.
In POP, Overloading is not possible.
C, VB, FORTRAN, Pascal.
Last modified 2yr ago
Copy link