Java is a general purpose programming language. The main feature that makes the Java language popular is “WORA” i.e. Write Once Run Anywhere. It means programs once written can run on any platform. Program written in Windows platform and compiled on Windows platform can run on Linux and Mac platform without recompiling the program or modifying the source code. This is achieved by generating the bytecode during the compiling process. Bytecode is an intermediate format which is than interpreted by JVM [ Java Virtual Machine ] at run time. As name says its a Virtual machine and not a physical machine its job is to translate bytecode in to executable code for the platform on which it is running. Following diagram shows the whole process.
So the process of executing java program is to compile the program to generate the bytecode and pass it through interpreter which will convert bytecode in to executable code and produce the output. Java code is saved using .java extension and bytecode generated by compiling process is saved by .class extension.
As said in starting Java is general purpose language which means that Java can be used in different paradigms like it can be procedural, functional, object oriented. Java is easy to learn as it derives most of its syntax from C and C++. Java is pure object oriented (OO) programming language hence support all the concepts of object oriented like Data Abstraction, Encapsulation, Inheritance, Polymorphism.
Java can be used for creating
- Console base application.
- Graphical User Interface – Desktop Application.
- Web base application.
- Mobile base application
- Enterprise application
- Embedded application
Basically think of any thing and it can be accomplished using Java.
Next post will explore how to install Java on different platforms.