Java is developed by Sun Microsystems in 1991 and it is a general purpose language.
Java is a high-level programming language that can be best described by the following keywords.
- Simple: Compared to other languages like C, C++, java is simple to understand. It is designed to overcome the drawbacks from other languages.
- Object oriented
- Architecture neutral
- Portable: Java code complied on a windows machine can be run on Unix machine without recompiling it.
- High performance
Platform independent language:
Platform means an environment (hardware/software) where program runs.
Java is platform independent.
Once code is compiled, it can be run on any platform without the need of recompiling it. WORA – Write Once Run Anywhere.
It is possible with the use of JVM (Java Virtual Machine).
Java Virtual Machine (JVM):
Java source code is stored in a text file with an extention .java
Java compiler compiles the .java code into byte code. Byte code is stored in a file with extension .class
JVM can interpret only the Byte code.
JVM is platform dependent. It varies from platform to platform. But java is platform dependent.
A class is a blueprint or prototype that contains variables and methods.
An object is a specimen of a class. It is a group of variables and methods/functions.
Features of OOP:
Abstraction: It is the process of extracting the essential information and hiding the irrelevant details.
Inheritance: It is a feature in which one class acquires the properties and functionalities of another class.
Encapsulation: It is a process of binding the code and data as a single unit.