First Java Program Hello World
For executing any java program we need given things.
- Install the JDK any version if you don’t have installed it.
- Set path of the jdk/bin directory.
- Create the java program
- Compile and run the java program
Steps For compiling and executing the java program
Java is very simple programming language first we write a java program and save it with program class name.In below program we create a java program with “First” name so we save this program with “First.java” file name. We can save our java program anywhere in our system or computer.
First program
class First{
public static void main(String[] args)
{
System.out.println(“Hello World”);
System.out.println(“This Is My First Java Program”);
}
}
Compile and Run the Java Program Like this :
To compile: javac First.java
To execute: java First
During the program execution Time internally follows This steps:
- Class loader subsystem loads or transfer the specified class into main memory(RAM) from secondary memory(hard disk)
- JVM takes the loaded class
- JVM looks for main method because each and every java program start executing from main() method.
- Since main() method of java is static in nature, JVM call the main() method with respect to loaded class
0 comments:
Post a Comment