How to create java file – Hello world java program code file

Java is a programming language made at Sun Microsystems by James Gosling, released in 1995. The most the of the syntax of the language is derived from C and c++. Java is object oriented programming language, it is based on the concept of classes and objects which is specifically designed to have as few implementation dependencies as possible. Java is one of the most popular language around the world and is widely used, specially for server-client web application. Sun Microsystems licensed most of its Java technologies under the General Public License(GNU). One characteristic of Java is portability, which means that computer programs written in the Java language must run similarly on any hardware/operating-system platform. The extension of Java document is “.java”, so whenever you create a Java document you’ll need to save the document with this extension.

How-to-create-java-file-Hello-world-java-program-code-file

Below is Hello world Java program code and steps to create a Java program file:

class HelloWorld
{
static public void main( String args[] )
{
System.out.println( “Hello World!” );                                       // Hello World in Java
}
}

STEP 1: Copy the above code, paste it into text editor like notepad.
STEP 2:save as” the document with the name you want, like “hello_world.java” to your home directory.
STEP 3: Compile it by typing “javac hello_world.java” in the terminal window like command prompt.
STEP 4: Now, Run (or execute) it by typing “java hello_world” in the terminal window.
STEP 5: Once execution is finished, you’ll see the output “Hello World!”.