It is a basic JAVA program to say to the world "Hello World". It is example for beginners to understand basic java code.
The name Java was derived at a local coffee shop frequented by some of the members and it's related to coffee material.
So In this basic program print Hello WORLD inside the coffee mug.
First install JDK(JAVA Development Kit) with latest version because to run java program need JVM(java virtual machine) when you install JDK then JVM installed in your system.
Java Virtual Machine(JVM) makes JAVA as platform independent.
Save Program
Type the program code in notepad and save Java program with classname.java. In this program save as hello.java.
File name and class name must be same.
Compile Program
javac hello.java
When compile program then it creates bytecode named with hello.class. class file created in same location where program stored.
Bytecode is a code which as same as machine language code.
Exicute the Program
java hello
Now we execute the bytecode in the Java interpreter with using this command.
Output
The name Java was derived at a local coffee shop frequented by some of the members and it's related to coffee material.
So In this basic program print Hello WORLD inside the coffee mug.
First install JDK(JAVA Development Kit) with latest version because to run java program need JVM(java virtual machine) when you install JDK then JVM installed in your system.
Java Virtual Machine(JVM) makes JAVA as platform independent.
Hello World JAVA Program
Program Codeclass hello //create class hello { public static void main(String[] args) //main method { System.out.println("\nExample to print HELLO WORLD in Coffee Mug\n"); System.out.println(" _______\n| |\n| |__\n| HELLO" +" | |\n| WORLD | |\n| |__| \n| |\n|_______|"); } }
Save Program
Type the program code in notepad and save Java program with classname.java. In this program save as hello.java.
File name and class name must be same.
Compile Program
javac hello.java
When compile program then it creates bytecode named with hello.class. class file created in same location where program stored.
Bytecode is a code which as same as machine language code.
Exicute the Program
java hello
Now we execute the bytecode in the Java interpreter with using this command.
Output