Introduction
In Java, there are certain steps for the creation and execution of a program. We can use the following procedure to easily create and execute a program in Java.
Procedure for the creation and execution of the program
- Install the Java Development Kit (JDK) in your system.
- Create the Java program.
- Open Notepad and write your program.
- Save your program as First.java.
- Set the path of the bin directory in the JDK.
- Now open a command prompt to compile and run your program.
Compile your program using:
javac First.java
Execute your program using:
Java First
Know Your Program
- We use "class" in our program. It is used to declare a class.
- We use "public" in our program. It is an access identifier in Java. In other words visible to all.
- We use "static" in our program. It is a keyword in Java. If a method is static in Java then there is no need to create an object of the class to use that specific method. The "main" method is the first method to be executed by the Java Virtual Machine. So by making it static we do not need to make an object to invoke the main method.
- We use "void" in our program. It is a return type in Java. Every method in Java must have a return type so we use it here. Void is a return type that does not return any value.
- We use "main" in our program. In Java, the main method is the starting point of the program. Every program in Java should have a main method.
- We use "String[] args" in our program. It is the command line argument in Java.
- We use "System.out.println()" in our program. It prints the specific statement in Java.
Summary
This article explains how to create and execute your first program in Java and also what is the meaning of your program.