JAVA is a programming language developed by James Gosling in 1995 at Sun Microsystems. It is a well reputed programming language and it has spread across the world at a faster rate. As the result we can see that most of the application for mobile, softwares for PC and web based applications all are JAVA oriented.
So, What Makes Java Special ?
JAVA is both Interpreter as well as Compiler based programming language. Though it is fully Object Oriented Programming (OOP) based language, it supports all object oriented features except multiple inheritance. You will be able to run JAVA programs on different devices and platforms without making different program code for different microprocessors instead you just compile it on the different devices, this property can be termed as “write once, compile anywhere”.
Once the JAVA program is compiled, a class file is created with. class extension which is executable on any platform. Therefore, it have “compile once, run anywhere” property also, which is achieved through JAVA Virtual Machine (JVM).
What is JVM (JAVA Virtual Machine)
When a JAVA program is compiled, it is converted into “Bytecode” instructions. These Bytecode are interpreted by the JVM, which provide the environment to execute the program. Every platform must have JVM to execute the JAVA program. Application programming interface (API) is implemented by a set of standard class libraries in which the JVM is distributed. JAVA Runtime Environment (JRE) is a combination of JAVA API and JVM.
Bytecode is executed by JIT (just-in-time Compiler) as they are faster than Interpreters.
Writing Your Program
They’re two ways to write a JAVA Programs on a computer:
- Using the JDK and Command Prompt.
- Using IDE (Integrated Development Environment) like NetBeans, Eclipse and BlueJ.
If you wish to use the first method, You must have JDK (JAVA Development Kit) installed on your PC. Then you can write a JAVA code in NOTEPAD of any text editor of your choice, then save it with a .java extension.
Here you must keep in mind that, your class name and file name should be exactly same, including case.
Run a Java Program
Next Step will be running a JAVA program through Command Prompt (CMD) for that follow the below steps:
- Open the command prompt, using win+R key and then type CMD in the run window
- Change directory to C:\Program Files\Java\jdk1.*\bin
- type javac filename.java
- It will compile your program. Now,
*Remember that class name will not have any extension
The Second method is easier as IDE is providing everything, editor and compiler in one place and you don’t need to use the command prompt, But we highly advise you to implement the first method first to understand the ease of working with JAVA.
There are many available IDE for JAVA but the most popular one is NetBeans, and easiest one is BlueJ for beginners.
The First JAVA program
In our first JAVA program we are going to simply print some details about you.
/*Biodata Program in JAVA*/
public static void main(String  args)
System.out.println("Name: Satya Prakash");
System.out.println("College: University of Allahabad");
Type this program in notepad and save as bio.java at this location C:\Program Files\Java\jdk1.*\bin (See Above Section)
So, try out your first program and if you face any problem in the way, let us know by leaving a comment below and will be helping you out for sure.