Java is a high-level object-oriented programming language using which software can be developed. Here I have a question for you what is a programming language?
A programming language is a set of instructions given to the machine to perform some tasks.
Applications that can be developed using java
- Desktop applications( Media player, antivirus, etc)
- Web Applications (eg: Facebook, irctc.com)
- Enterprise Applications (eg: banking application)
- Mobiles.
- Games etc.
Who developed Java?
Java was developed by James Gosling in 1996. (JDK version – 1.0) (JDK – Java Development Kit) .He was working in Sun Microsystem, so officially it was developed by Sun Microsystem, and now it is overtaken by Oracle corporation.
Why the language name is Java?
Java is the name of an island in Indonesia, where coffee was first produced. They have given the Java name in the name of that island.
What are the features of Java?
- Simple: It is very simple to learn and implement.
- Robust
- High Performance
- Portable
- Multi-Threaded: Multiple lines of code can be executed at the same time.
- Platform Independent
How Java is Robust Programming Language?
Java has a very unique feature to handle the memory in a more efficient and effective manner compared to other programming languages. It frees up the memory automatically for the Object which is not in use.
Java has a Garbage Collector which is used for deleting the unused Object from the memory. So, that memory becomes free and can be used for storing the other new Object. This concept in Java is called Garbage Collection.
Can be explicitly removed or delete the Object in Java?
No, we cannot remove the Object, rather we can make it eligible for Garbage Collection.
Two ways of Making any Object to eligible for the Garbage Collection.
- Creating another Object with the same Object Reference.
2. Assigning Null to the Object Reference which is a reference to the Object.
Note: Here we are only making object eligible for Garbage Collection, we are not deleting from the memory. Once the object becomes eligible for Garbage Collection then JVM will automatically remove or delete that Object from the Memory.
Deleting any Object is completely depends upon JVM we cannot do by ourselves.
Why Java is called Object Oriented Programming Language?
All the things in java are considered to be an Object, which highly related to real-world object around us. In java, Object is defined as Real World Physical Entity. Anything which is physically present is considered to be an Object.
Hence, Java is Object Oriented Programming Language.
There is four important Pillar of any Object-Oriented Programming Language.
- Inheritance.
- Polymorphism.
- Abstraction.
- Encapsulation
Note: I explained all these terms in detail in other articles, please refer for better understand.
JDK in Java
JDK is the Java Development Kit. It is a Software Development Kit for java that contains necessary resources to compile as well as to execute a java-based program or application. Jdk in java contains tools required to develop and execute the java programs.
JDK is divided into two components.
- Development Tools
- JRE(Java Runtime Environment)
JDK Tools in Java
The following are the development tools present in the Java Development Kit.
- Compiler: javac.exe
- Application Launcher or java program: java.exe
- Many more.
JDK tool is used to develop a java program so that we can compile after writing the code.
What is JRE in Java?
It is a Java Runtime Environment that is required to execute the java Application bytecode. JRE can be downloaded separately, using only JRE we can’t develop the java program.
Bytecode
It is a compiled format or language of java programs, which the JVM will understand and execute.
Important points of Bytecode
- It is platform-independent.
- The extension of bytecode is .class
- It is not a high level or low-level language rather it is an intermediate language.
JRE consists of two important Components.
- JVM (Java Virtual Machine)
- Java Library
JVM(Java Virtual Machine)
It is a software which used to translate the bytecode into platform-specific instructions. It converts the bytecode into code which the machine can understand, and this conversion depends upon the operating system and hardware combination.
JVM is platform dependent, that means it is different for different Operating systems such as JVM used for windows is not the same for Mac or Linux.
How the compilation and execution of code happened at the root level?
When you try to compile the source code let say the file name of code is MyFirstProgram.java, the compiler of Java that is javac, it will convert your code into the bytecode.
This bytecode is platform-independent and the extension of this file is .class so in our example file name is MyFirstProgram.class
Since bytecode is platform-independent, it means the same bytecode we can use it on the different operating systems. But here is the problem, the operating system does not understand the bytecode.
So in order to solve this issue, Java Community has developed the JVM for every Operating system that is for windows JVM is different than Linux.
Extension of the final file.
The purpose of JVM is to translate the bytecode into platform-specific instruction.
What is Javac in Java?
It is a java compiler which only used to check the syntax of the source code. Javac does not check the logic of code.
Compilation of Source code is done in two steps:
- Check the syntax of the java program.
- If the program syntax is correct then it will generate the bytecode otherwise it will throw compilation error.
How java is platform-independent?
Java is a platform-independent because once we write java programs, we can execute it on any platform. Java code will be compiled into bytecode (.class file ) by the compiler.
And this byte code is platform-independent. It means, the bytecode can be executed in any specific platform provided we have a platform-specific Java Runtime environment.
Because of platform-independent feature, we call Java as WORA — Write Once, Run Anywhere.
Note: JRE of the windows system will be different from JRE of the MAC system.
Important Instruction to fellow Readers.
Please refer to the article for Polymorphism, Encapsulations, Abstraction, and Inheritance. There are separate articles for each of the Object-Oriented Concepts. It will help you to understand in a better way. Each concept I explained in a very proper way with the Real World Examples along with Java Examples.
Thanks a lot for reading my article. It’s highly appreciated. I hope you must learn something new from here.
And if you have any suggestions regarding my articles Please let me know. If you want to learn some other concept of Java, please check out the articles list in the Right Corner of your screen.